Asked such a question

int x = null; 

Naturally it is impossible, but is it possible to get around somehow?

  • the counter question - why? - Gorets pm

3 answers 3

 int? x = null; 

Will not work? Here's the article: Types that allow NULL values ​​(C # Programming Guide) .

I think, nizya because primitives are not objects, therefore they must be declared necessarily. If you really want - there are wraps over them.

    As I remember, the NULL type of the variable int cannot take, usually assign a value equal to 0.

    • @UserTest mentioned the existence of a Nullable<T> and its wrapper T? - Specter