Answer: Yes we can assign null to a variable of DateTime datatype
For ex :
.Consider this snippet
class A
{
static void Main()
{
DateTime? a=null;
Console.WriteLine("value"+"---"+a);
}
}
//Compile it and execute:
//Explanation:
//DateTime is a nullable data type(it is a value type) whose variable can be assigned null values when declared with ? sign.
In the output, we shall see the string value concatenated with blank string
Asked In: Many Interviews |
Alert Moderator