🌐
Answers
answers.com › finance › What_does_null_mean_in_banking_terms
What does null mean in banking terms? - Answers
January 20, 2014 - In banking terms, "null" typically refers to a transaction or document that is invalid or has no legal effect. This could be due to missing or incorrect information, unauthorized activity, or other reasons that make the transaction void.
🌐
Reddit
reddit.com › r/netsuite › "(null)" at the end of transactions
r/Netsuite on Reddit: "(null)" At the end of transactions
July 9, 2022 -

Hi! Why does certain transactions have "(null)" at the end? Is it because there are not entities (customer, vendors, etc) at the end? For invoices for example the we would have the name of the customers at the end in brackets.

Update: I added a screenshot just to show what I mean (i censored parts of the prefix)

🌐
Merriam-Webster
merriam-webster.com › dictionary › null
NULL Definition & Meaning - Merriam-Webster
Null often pops up in legal and scientific contexts; it was originally used in Scottish law and still carries the meaning "having no legal or binding force," especially in the phrase "null and void." In mathematics, it is sometimes used to mean "containing nothing"; for example, the set of all whole numbers that are divisible by zero is the "null set" (that is, there are no numbers that fit that description).
🌐
Quora
quora.com › What-does-it-mean-when-it-s-imprinted-on-the-back-of-a-cashed-check-USB-null
What does it mean when it’s imprinted on the back of a cashed check-USB null? - Quora
Answer: Did they cash the check? if so, it’s likely something the bank is noting on the check for in-house use. For declined deposits, there are several ways to mark the check, NSF could be insufficient funds, or it could be a stopped payment, or it could be a closed account. There are also ma...
🌐
Infinite Kind
infinitekind.tenderapp.com › discussions › general-questions › 26203-null-in-the-memo-field
"null" in the memo field / General Questions / Discussion Area - Infinite Kind Support
She obviously tired of deflecting my evidence and supposedly recorded my details on a “work ticket” to be given to someone who actually knows something and who is supposed to get in touch with me in 3 business days. I suggest we not hold our breath till then! Meanwhile, every couple of weeks, I’ll just use the find and replace function on MD to replace “null” with….
Find elsewhere
🌐
Oracle
docs.oracle.com › en › cloud › saas › financials › 25a › fairp › what-s-the-difference-between-a-null-data-point-value-and-a-zero.html
What's the difference between a null data point value and a zero data point value?
February 25, 2025 - For example, for the Count of Invoices Paid Late data point, a null value means that no payments have been made, while a zero value means that all invoices were paid on time.
🌐
Checkout51
support.checkout51.com › hc › en-us › articles › 201387147-Getting-my-balance-back-if-my-account-balance-says-null
Getting my balance back if my account balance says "null." – Checkout 51 Help Desk
If your balance on the account page says "null," something has probably gone wrong. To fix this simply force close and re-open the Checkout 51 application. For instructions on how to force close ap...
🌐
O'Reilly
oreilly.com › library › view › sql-in-a › 1565927443 › ch02s04.html
Processing NULLS - SQL in a Nutshell [Book]
In the relational database world, NULL literally means that the value is unknown or indeterminate. (This question alone — whether NULL should be considered unknown or indeterminate — is the subject of academic debate.) This differentiation enables a database designer to distinguish between those entries that represent a deliberately placed zero and those where either the data is not recorded in the system or where a NULL has been explicitly entered. For an example of this semantic difference, consider a system that tracks payments.
🌐
TheFreeDictionary.com
financial-dictionary.thefreedictionary.com › null
Null financial definition of null
... Describing anything that cannot be enforced legally. For example, a contract may be declared null and void if one party enters it under duress or if its terms violate local law.
🌐
Square
developer.squareup.com › questions
Credit card statement purchase description contains null? - Questions - Square Developer Forums
November 16, 2022 - I am using the Checkout API to handle purchases. I ran a couple test purchases using Production and this is what I saw on my credit card statement. Why does it contain null and XXXXXs? SQ *EPGSOFT gosq.com FL null XXXXX…
🌐
RIO Education
help.rioeducation.com › en_US › faq-feebilling-management › payment-method-null-null-error
Payment Method (null - null) error - RIO Education
The (null - null) you see is the actual values you have for ([Fee Type] - [Fee Type Option]). This means that you have nothing set in these fields, so somewhere along the way you were missing this data, and now nothing is matching the metadata.
🌐
Khoury College of Computer Sciences
khoury.northeastern.edu › home › kenb › MeaningOfNull.html
The Meaning of Null in Databases and Programming Languages
That certainly is true in this ... does not include the one to which a person most closely identifies. The NULL in this case represents "none of the above" or "other"....
Top answer
1 of 8
509

TL;DR

The key to understanding what null! means is understanding the ! operator. You may have used it before as the "not" operator. However, since C# 8.0 and its new "nullable-reference-types" feature, the operator got a second meaning. It can be used on a type to control Nullability, it is then called the "Null Forgiving Operator".

Basically, null! applies the ! operator to the value null. This overrides the nullability of the value null to non-nullable, telling the compiler that null is a "non-null" type.


Typical usage

Assuming this definition:

class Person
{
    // Not every person has a middle name. We express "no middle name" as "null"
    public string? MiddleName;
}

The usage would be:

void LogPerson(Person person)
{
    Console.WriteLine(person.MiddleName.Length);  // WARNING: may be null
    Console.WriteLine(person.MiddleName!.Length); // No warning
}

This operator basically turns off the compiler null checks for this usage.

Technical Explanation

The groundwork that you will need to understand what null! means.

Null Safety

C# 8.0 tries to help you manage your null-values. Instead of allowing you to assign null to everything by default, they have flipped things around and now require you to explicitly mark everything you want to be able to hold a null value.

This is a super useful feature, it allows you to avoid NullReferenceExceptions by forcing you to make a decision and enforcing it.

How it works

There are 2 states a variable can be in - when talking about null-safety.

  • Nullable - Can be null.
  • Non-Nullable - Cannot be null.

Since C# 8.0 all reference types are non-nullable by default. Value types have been non-nullable since C# 2.0!

The "nullability" can be modified by 2 new (type-level) operators:

  • ! = from Nullable to Non-Nullable
  • ? = from Non-Nullable to Nullable

These operators are counterparts to one another. The Compiler uses the information that you define with these operators to ensure null-safety.

Examples

? Operator usage.

This operator tells the compiler that a variable can hold a null value. It is used when defining variables.

  • Nullable string? x;

    • x is a reference type - So by default non-nullable.
    • We apply the ? operator - which makes it nullable.
    • x = null Works fine.
  • Non-Nullable string y;

    • y is a reference type - So by default non-nullable.
    • y = null Generates a warning since you assign a null value to something that is not supposed to be null.

Nice to know: Using object? is basically just syntactic sugar for System.Nullable<object>

! Operator usage.

This operator tells the compiler that something that could be null, is safe to be accessed. You express the intent to "not care" about null safety in this instance. It is used when accessing variables.

string x;
string? y;
  • x = y
    • Illegal! Warning: "y" may be null
    • The left side of the assignment is non-nullable but the right side is nullable.
    • So it does not work, since it is semantically incorrect
  • x = y!
    • Legal!
    • y is a reference type with the ? type modifier applied so it is nullable if not proven otherwise.
    • We apply ! to y which overrides its nullability settings to make it non-nullable
    • The right and left side of the assignment are non-nullable. Which is semantically correct.

WARNING The ! operator only turns off the compiler-checks at a type-system level - At runtime, the value may still be null.

Use carefully!

You should try to avoid using the Null-Forgiving-Operator, usage may be the symptom of a design flaw in your system since it negates the effects of null-safety you get guaranteed by the compiler.

Reasoning

Using the ! operator will create very hard to find bugs. If you have a property that is marked non-nullable, you will assume you can use it safely. But at runtime, you suddenly run into a NullReferenceException and scratch your head. Since a value actually became null after bypassing the compiler-checks with !.

Why does this operator exist then?

There are valid use-cases (outlined in detail below) where usage is appropriate. However, in 99% of the cases, you are better off with an alternative solution. Please do not slap dozens of !'s in your code, just to silence the warnings.

  • In some (edge) cases, the compiler is not able to detect that a nullable value is actually non-nullable.
  • Easier legacy code-base migration.
  • In some cases, you just don't care if something becomes null.
  • When working with Unit-tests you may want to check the behavior of code when a null comes through.

Ok!? But what does null! mean?

It tells the compiler that null is not a nullable value. Sounds weird, doesn't it?

It is the same as y! from the example above. It only looks weird since you apply the operator to the null literal. But the concept is the same. In this case, the null literal is the same as any other expression/type/value/variable.

The null literal type is the only type that is nullable by default! But as we learned, the nullability of any type can be overridden with ! to non-nullable.

The type system does not care about the actual/runtime value of a variable. Only its compile-time type and in your example the variable you want to assign to LastName (null!) is non-nullable, which is valid as far as the type-system is concerned.

Consider this (invalid) piece of code.

object? null;
LastName = null!;
2 of 8
37

null! is used to assign null to non-nullable variables, which is a way of promising that the variable won't be null when it is actually used.

I'd use null! in a Visual Studio extension, where properties are initialized by MEF via reflection:

[Import] // Set by MEF
VSImports vs = null!;
[Import] // Set by MEF
IClassificationTypeRegistryService classificationRegistry = null!; 

(I hate how variables magically get values in this system, but it is what it is.)

I also use it in unit tests to mark variables initialized by a setup method:

public class MyUnitTests
{
    IDatabaseRepository _repo = null!;

    [OneTimeSetUp]
    public void PrepareTestDatabase()
    {
        ...
        _repo = ...
        ...
    }
}

If you don't use null! in such cases, you'll have to use an exclamation mark every single time you read the variable, which would be a hassle without benefit.

Note: cases where null! is a good idea are fairly rare. I treat it as somewhat of a last resort.

🌐
Italia Fideiussioni
italiafideiussioni.it › home › news and insights › when a surety bond is null: an in-depth legal analysis
When a surety bond is null: an in-depth legal analysis - Italia Fideiussioni
November 12, 2024 - 2 of Law No. 287 of 1990) renders the surety bond null. A surety bond following an illicit agreement between banks is considered null, regardless of when such an agreement is ascertained.