Sitemap
coding | seaphylla | omnivorous

coding | seaphylla | omnivorous

I write about coding, AI, philosophy of mind, and logic with intellectually omnivorous curiosity. Founder of OnlyFangirling.com. The joke is, I only fangirl.

Member-only story

The Question Mark Is a Maybe

What string?, int?, null, ?., ?? and ! actually mean in C#

7 min readSep 27, 2026

--

Learning C# means learning its syntax. You get used to parentheses, braces and semicolons fairly quickly. Then characters such as ? start appearing in places where their purpose is much less obvious.

So today, let’s focus on just one of them. What does ? mean in C#?

Press enter or click to view image in full size
Photo by crazy motions: https://www.pexels.com/photo/dark-and-illuminated-question-marks-12920835/

The slightly inconvenient answer is that it depends on where you find it. You might see it attached to a type

string? name = null;
int? age = null;

You might find it before a dot

int? length = name?.Length;

Or doubled

string displayName = name ?? "Unknown";

And just when the question mark starts making sense, an exclamation mark appears

int length = name!.Length;

These symbols are not doing exactly the same thing, but most of them revolve around the same problem.

Sometimes a value might not be there. To understand what C# does about that, we need to start with null.

When Nothing Is a Valid Value

null represents the absence of a value. That sounds simple enough, but absence can carry useful…

--

--

coding | seaphylla | omnivorous
coding | seaphylla | omnivorous

Written by coding | seaphylla | omnivorous

I write about coding, AI, philosophy of mind, and logic with intellectually omnivorous curiosity. Founder of OnlyFangirling.com. The joke is, I only fangirl.