C# Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 504 Page Views: 

How do you use nullable types?



Posted By: Avi Date: 15 October 2010 03:09:46 AM
 Answer:

int? num = null; //declaration if(num.HasValue == true) Console.Write(num.Value); else Console.Write(“null”);


Posted By: avibtech


Date: 15 October 2010 03:09:46 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image AvRgPM
Related Questions
C# : What does the ?? operator do?

What does the ?? operator do?

it returns left-hand operand if it is not null else right-hand.
Category: C# Date: 10/13/2010 10:35:47 PM
C# : How do you define indexer in interface?

How do you define indexer in interface?

public interface ISample { string this[int idx] {get;set;}}
Category: C# Date: 10/13/2010 10:21:14 PM
C# : How do you create anonymous function that prints string on console?

How do you create anonymous function that prints string on console?

delegate void SampleDelegate(string s); SampleDelegate d = delegate(string s) {Console.WriteLine(s);....
Category: C# Date: 10/13/2010 10:16:14 PM
C# : What will be the result of the following code:
List<string> list;
Foreach(string s in list)
Console.WriteLine(s);

What will be the result of the following code: List list; Foreach(string s in list) Console.....

Runtime exception – null reference because list is not set anywhere.
Category: C# Date: 10/13/2010 9:00:31 PM
C# : Can property be passed as a ref parameter?

Can property be passed as a ref parameter?

No, property is method.
Category: C# Date: 10/13/2010 8:58:14 PM