This was intended as a meme but is actually a good representation of what "Null" is. In C#, when you declare string s = "My shit"; it means that "s" is a reference to a memory location that holds the data "My shit". string s = null; means that the reference "s" exists but it's not pointing to any object, as in it holds nothing. Answer from abd53 on reddit.com
🌐
Merriam-Webster
merriam-webster.com › dictionary › null
NULL Definition & Meaning - Merriam-Webster
February 24, 2026 - The meaning of NULL is having no legal or binding force : invalid. How to use null in a sentence. Did you know?
🌐
Dictionary.com
dictionary.com › browse › null
NULL Definition & Meaning | Dictionary.com
NULL definition: without value, effect, consequence, or significance. See examples of null used in a sentence.
Discussions

What is Null?
This was intended as a meme but is actually a good representation of what "Null" is. In C#, when you declare string s = "My shit"; it means that "s" is a reference to a memory location that holds the data "My shit". string s = null; means that the reference "s" exists but it's not pointing to any object, as in it holds nothing. More on reddit.com
🌐 r/learnprogramming
60
34
July 5, 2024
What does “null” mean and why is it here
🌐 r/discordapp
43
51
March 21, 2023
c# - What does null! statement mean? - Stack Overflow
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. More on stackoverflow.com
🌐 stackoverflow.com
Text messages from my own number that just say "null"
Do you have delivery reports turned on for mms/sms? More on reddit.com
🌐 r/verizon
9
2
October 1, 2022
🌐
Vocabulary.com
vocabulary.com › dictionary › null
Null - Definition, Meaning & Synonyms | Vocabulary.com
Null means having no value; in other words null is zero, like if you put so little sugar in your coffee that it’s practically null. Null also means invalid, or having no binding force.
🌐
Cambridge Dictionary
dictionary.cambridge.org › us › dictionary › english › null
NULL | definition in the Cambridge English Dictionary
1 week ago - NULL meaning: 1. having no legal force: 2. with no value or effect: 3. (of a set or matrix) containing nothing…. Learn more.
🌐
Wikipedia
en.wikipedia.org › wiki › Null
Null - Wikipedia
February 23, 2026 - Null (SQL) (or NULL), a special marker and keyword in SQL indicating that a data value does not exist, is not known, or is missing.
🌐
Collins Dictionary
collinsdictionary.com › us › dictionary › english › null
NULL definition in American English | Collins English Dictionary
6 senses: 1. without legal force; invalid; (esp in the phrase null and void) 2. without value or consequence; useless 3..... Click for more definitions.
Find elsewhere
🌐
Wikipedia
en.wikipedia.org › wiki › Null_(mathematics)
Null (mathematics) - Wikipedia
February 4, 2026 - In mathematics, the word null (from German: null meaning "zero", which is from Latin: nullus meaning "none") is often associated with the concept of zero, or with the concept of nothing.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Glossary › Null
Null - Glossary - MDN Web Docs
In computer science, a null value represents a reference that points, generally intentionally, to a nonexistent or invalid object or address. The meaning of a null reference varies among language implementations. In JavaScript, null is marked as one of the primitive values, because its behavior ...
🌐
YourDictionary
yourdictionary.com › home › dictionary meanings › null definition
Null Definition & Meaning | YourDictionary
A null result. ... Of or relating to a set having no members or to zero magnitude. ... A non-existent or empty value or set of values. ... An instrument reading of zero. ... Zero; nothing. ... Something that has no force or meaning. ... (computing) The ASCII or Unicode character (␀), represented ...
🌐
Reddit
reddit.com › r/discordapp › what does “null” mean and why is it here
r/discordapp on Reddit: What does “null” mean and why is it here
March 21, 2023 - Null is pretty much an empty placeholder in a variable it's neither empty or set with a value, in short if it showing a UI it means a dev messed up
🌐
Khoury College of Computer Sciences
khoury.northeastern.edu › home › kenb › MeaningOfNull.html
The Meaning of Null in Databases and Programming Languages
For the rest of this article, I will use the convention that "NULL" (all uppercase letters) means "database null" and "null" (all lowercase letters) means "programming language null". One consequence of defining NULL differently from null is that one cannot use ordinary Boolean logic.
🌐
freeCodeCamp
freecodecamp.org › news › a-quick-and-thorough-guide-to-null-what-it-is-and-how-you-should-use-it-d170cea62840
A quick and thorough guide to ‘null’: what it is, and how you should use it
June 12, 2018 - So, variable name doesn't point to "Bob" anymore. The value 0 (all bits at zero) is a typical value used in memory to denote null. It means that there is no value associated with name.
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.

🌐
Quora
quora.com › What-exactly-is-NULL
What exactly is NULL? - Quora
Answer (1 of 25): It means nothing. Most literally. It means that it has no meaning. It can best be understood when dealing with dates and numbers. Alpha-numeric NULL is awkward and not really accurate, as it differentiates between a blank string ...
🌐
Springer
link.springer.com › home › inside relational databases with examples in access › chapter
What does null mean? | Springer Nature Link
If you don’t enter a value into a field in a particular record, you might think that the field was simply empty, but life isn’t that simple. Instead the field is said to contain a null value. If, for example, a field is supposed to contain the phone number of a friend but you don’t know the phone number, you don’t enter any data.
🌐
Longman
ldoceonline.com › dictionary › null
null | meaning of null in Longman Dictionary of Contemporary English | LDOCE
From Longman Dictionary of Contemporary Englishnullnull /nʌl/ adjective → null and voidExamples from the Corpusnull• He decided that the marriage was null and void.• Figure 8.5 Projections of two neighbouring null geodesics on to the plane.• The use of the null hypothesis does have one very practical use.• The researcher may actually expect that the null hypothesis is faulty and should be rejected in favor of the alternative H1.• The null hypothesis that can then be tested by using the F distribution as explained in chapter 3.• This gives variables of exactly known distribution,
🌐
Encyclopedia Britannica
britannica.com › dictionary › null
Null Definition & Meaning | Britannica Dictionary
NULL meaning: having no legal power often used in the phrase {phrase}null and void{/phrase}
🌐
UpCounsel
upcounsel.com › legal-def-of-null
Check out this article...What Does Null Mean in Court and Contract Law?
April 23, 2025 - When an act, contract, or legal proceeding is declared null, it is treated as though it never existed. This concept applies broadly across civil law, contract disputes, family law, and other legal arenas.
🌐
Wiktionary
en.wiktionary.org › wiki › null
null - Wiktionary, the free dictionary
Something that has no force or meaning. (computing) The null character; the ASCII or Unicode character (␀), represented by a zero value, which indicates no character and is sometimes used as a string terminator.