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
  • 112,162
  • 17
  • 191
  • 293
rozar
  • 1,048
  • 1
  • 15
  • 27

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,335,956
  • 823
  • 8,931
  • 9,049