0
public static implicit operator byte(BytesType o) { return ConvertTo<byte>(o); }

The above does an implicit conversion from object o of type BytesType to byte.

But what does the following do

public static implicit operator byte?(BytesType o) { return ConvertTo<byte>(o); }

Particularly the conditional operator. What does the conditional operator signify?

Thanks in advance.

leppie
  • 115,091
  • 17
  • 196
  • 297
rozar
  • 1,058
  • 3
  • 15
  • 28

1 Answers1

9

It's not a conditional operator - it's just the shorthand for Nullable<T>, in the same way as if you were declaring a variable or a parameter. So that's equivalent to:

public static implicit operator Nullable<byte>(BytesType o)
{ 
    return ConvertTo<byte>(o);
}
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194