I’m sure this information is available in the C# spec, but I thought I’d give y’all a chance to set me straight. Why won’t this code compile?
namespace DataObjects
{
class QuestionMark
{
public bool Possible? {get; set;}
}
}
Is there any way I can make my boolean properties end in a question mark? I think it would add to readability and be nifty.
Let’s hear it!
I actually don’t think it has much to do with nullable types as that is easy to determine base on a type declaration. It probably has more to do with the ternary operator. If you had a variable with a ? at the end you wouldn’t be able to determine the difference between a normal reference to a variable and a ternery call. For example: