>Forgive me, but I am but a complete newbie to .NET. Most of the syntax I can figure out on my own, but this one has me really puzzled: this.GetOrderDetail((int?)e.PrimaryKeyValue);
>
>Why is int? in parens? Why is there a question mark after int? Am I confusing anybody else besides myself?
>
>I'm going to go out on a limb here, but I'm guessing that e.PrimaryKeyvalue is being typed as int. Correct me if I'm wrong.
>
>Jim
Jim,
You are coming from VFP so saying it with VFP example might work better.
Consider you have a new record in buffer. A field's OLDVAL() is null (record is new no valid oldvalue). Also consider it's of type integer.
(int)e.PrimaryKeyValue
casts e.PrimaryKeyValue to an integer. Having ? tells that it could be null.
int? x = null;
would not work if nullable types didn't exist (like it didn't in .Net 1.1). Before you could only use nulls with reference types (ie: string).
You wouldn't be also able to compare if int x is null (because they were not nullable before).
?? operator lets you check types being null with a shorthand notation. ie: If x is null consider x is 100, else whatever it has the value (VFP: nvl(x,100)):
y = x ?? 100;
Also check Nullable class.
Cetin