I’ve been working on the Microsoft Imagine Cup 2009 competition for the Game Design with one of my class mate. I looked at the sample codes to identify the location for the intersection between a ray and the vertex of a mesh. I recognized that the sample code that checks the distance between the ray and the intersection has a weird question mark that I have never seen in any other languages (i.e. float? intersection). The question mark is usually placed right after the primitive data types such as float, int, double, etc. I looked over the web and I found this:

public System.Data.DataSet GetRecords(int? foreignKey)

From the example above, it is quite easy to notice the inclusion of the ? character after the data type of the parameter. This function could now be called with an integer or NULL for the parameter. A parameter has to be specified, however, because C# does not allow default parameters for some stupid unknown reason. You guessed it, this becomes really useful when you are executing statements on a database that contains fields that are null-able but defined as an ordinal type. (Ordinal types are int, bool, double, float etc. etc.)

Note that question mark is commonly used in many other languages to declare a conditional if.. else.. statement:

([condition])? [value if true] : [value if false]