Create a nullable datatype in csharp.

by 11:35 PM 0 comments

Hi, folks here is the new trick to create the nullable datatypes in csharp..

As sometimes we need to pass the null data in the application we can use this formula...

So how can we make the datatypes like DateTime or Integer as a nullable

here is the tip.

Enjoy...

if we create the types in a following manner it can not accept the null values..

DateTime date = new DateTime();
date = null;

or

int i = null

and if we want to pass the null values to there variables we can declare them in the following manner..

DateTime? date = new DateTime();
date = null;
int? i = null


..Wish u a very happy programming ..!



Ravi Tuvar

Developer

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

0 comments:

Post a Comment