Given a method:
private static T GetBin<T>(string file)
Is it possible to set T to default to object
, if I use:
public static byte[] ToJSONBytes<T>(this T obj)
It defaults to whatever obj
is set as. However, this GetBin method Deserializes a file, using the BinaryFormatter, and as you all know, it returns an object. My method explicitly casts it to T and then returns it, but I want to make T optional and default to object
.