eg.
public bool AddProduct(string productName, int? supplierID, int? categoryID, string quantityPerUnit, decimal? unitPrice, short? unitsInStock, short? unitsOnOrder, short? reorderLevel, bool discontinued)
Explained :
int?, is the shortcut way of saying Nullable
Value types, such as Int32, cannot hold the value null. This is a problem when dealing with databases, which can distinguish "no value" (e.g. DBNULL) from 0 and the ordinary range of values. The Nullable
So, to summarise.
int is a .NET value type holding a signed 32-bit integer. It has no HasValue or Value properties because it just is the value.int? is a shortcut for writing Nullable
No comments:
Post a Comment