Why return type? from a method?
I'm looking at some C# intro stuff, and they say you can return a value from a method, and that you can specify ?:
Code:
class Foo
{
byte? Bar()
{
return 0xFF;
}
}
Normally, from my understanding, you use ? to say the variable can be set to null (but apparently you can't use it on strings, even though they didn't say why):So why am I specifying a ? on a method value? To say that I might be returning null, or so that I can assign my return value to something previously specified as having ??
Code:
byte? b;
b = Foo.Bar();
They're not clear on why I would want to be able to add a ? to my method's return type.
Quzah.