0

Possible Duplicate:
C# Nullable<int> vs. int?: Is there any difference?

When using NMG( Nhibernate Mapping generator) when the nullable type are converted I got them as System.Nullable<decimal> whereas by using Visual Nhibernate trail pack I got the nullable types as decimal?

I know what is decimal? does, it is accepted with out throwing errors in case of null values in non-technical terms.

But I could not find out if there is any difference between decimal? and System.Nullable<decimal> or not?

Community
  • 1
  • 1
navule
  • 3,212
  • 2
  • 36
  • 54

4 Answers4

2

From MSDN - Nullable Types (C# Programming Guide)

The syntax T? is shorthand for System.Nullable<T>, where T is a value type. The two forms are interchangeable.

Jon Senchyna
  • 7,867
  • 2
  • 26
  • 46
1

no difference. decimal? is converted to Nullable<decimal> at compile time. It can say syntactic sugar

Govind Malviya
  • 13,627
  • 17
  • 68
  • 94
1

decimal? is a short way of doing System.Nullable this is already answered at ? (nullable) operator in C#

hope it helps..

Community
  • 1
  • 1
HatSoft
  • 11,077
  • 3
  • 28
  • 43
0

There is no difference between both. type? is only a shortcut notation.

Piotr Perak
  • 10,718
  • 9
  • 49
  • 86