Insert NUll in value datatype like int,float in C#

  • Home
  • Blog
  • Insert NUll in value datatype like int,float in C#

Some times we need to make some data type to null. Likein some cases like stored procedure in database.We can do it in C# very easily. by just putting ?sign in’

the definition like below:

int? a;

that’s it! you have created a value data type with null

database. If you don’t supply a value to the int a thenit will remain null.

You can use this for any value data type like short,single,

double,long,decimal etc.

Happy Programming…