Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is Nullable Type in c#

Answers were Sorted based on User's Feedback



What is Nullable Type in c#..

Answer / raju

Nullable type is nothing but value type cant store null values
only reference type can store null values.whenever you
assign null values to value type variable from your backend
tables at that time we use nullable.

int? x;

Is This Answer Correct ?    26 Yes 2 No

What is Nullable Type in c#..

Answer / mistry

Nullable types are instances of the System.Nullable struct.
A nullable type can represent the normal range of values
for its underlying value type, plus an additional null
value. For example, a Nullable<Int32>, pronounced "Nullable
of Int32," can be assigned any value from -2147483648 to
2147483647, or it can be assigned the null value. A
Nullable<bool> can be assigned the values true or false, or
null. The ability to assign null to numeric and Boolean
types is particularly useful when dealing with databases
and other data types containing elements that may not be
assigned a value.

Is This Answer Correct ?    6 Yes 0 No

What is Nullable Type in c#..

Answer / sagar

csharp provided a new concept of nullable type in which we
can store null values to integer data type , previously
like c , c++ its not possible to store null values in value
types,this languages supports to store null values only in
reference types.

Is This Answer Correct ?    4 Yes 1 No

What is Nullable Type in c#..

Answer / vishnu

Declare a variable as nullable if you want to be able to
determine whether a value has been assigned. For example, if
you are storing data from a yes/no question on a form and
the use did not answer the question, you should store a null
value. The following code declares a boolean variable the
can be true, false, or null:

`VB
Dim b As Nullable(of Boolean) = Nothing

//C#
Nullable<bool> b = null;

//Shorthand notation, only for C#
bool? b = null;

Declaring a variable as nullable enables the HasValue and
Value members. Use HasValue to detect whether a value has
been set as follows:

`VB
If b.HasValue Then Console.WriteLine(“b is {0}.”, b.Value)
Else Console.WriteLine(“b is not set”);

//C#
If (b.HasValue)
Console.WriteLine(“b is {0}.”, b.Value);
Else
Console.WriteLine(“b is not set.”);

----------------------------

Exmaple:
class NullableExample
{
static void Main()
{
int? num = null;
if (num.HasValue == true)
{
System.Console.WriteLine("num = " + num.Value);
}
else
{
System.Console.WriteLine("num = Null");
}

//y is set to zero
int y = num.GetValueOrDefault();

// num.Value throws an InvalidOperationException if
num.HasValue is false
try
{
y = num.Value;
}
catch (System.InvalidOperationException e)
{
System.Console.WriteLine(e.Message);
}
}
}

Is This Answer Correct ?    1 Yes 1 No

What is Nullable Type in c#..

Answer / master

which is nullable... is the nullable type....

Is This Answer Correct ?    2 Yes 21 No

Post New Answer

More C Sharp Interview Questions

Why multiple inheritance is not possible in c#

8 Answers  


Why we use oops in c#?

0 Answers  


What is void method?

0 Answers  


Can a class have more than 1 destructor?

0 Answers  


What is the use of the dispose method in C# ?

0 Answers   Infosys,


What language is c# similar to?

0 Answers  


How do you implement multiple inheritance in .NET?

10 Answers   Microsoft,


Where do we use static class in c#?

0 Answers  


How is exception handling implemented in c#?

0 Answers  


Name some properties of array.

0 Answers  


What is the difference between class and namespace?

0 Answers  


Explain how do I convert a string to an int in c#?

0 Answers  


Categories