That's really easy. Just use object like so:
object obj = new BinaryFormatter().Deserialize(fileStrieam);
and then do what you said you would do:
if (!(obj is MyOwnGenericClass<string>)) throw new Exception("It was something other than MyOwnGenericClass<string>"); else { MyOwnGenericClass<string> asMyOwn_OfString = obj as MyOwnGenericClass<string>; // do specific stuff with it asMyOwn.SpecificStuff(); }
So you're not checking if T is a string. You're checking more than that: You're checking if obj is a MyOwnGenericClass< string >. Nobody said it will always be a MyOwnGenericClass< something > and our only headache is to find what that something is.
You can send bools, strings, ints, primitive arrays of int, even a StringBuilder. And then there's your entourage: you could send MyOwnGenericClass< int >, MyOwnGenericClass< string > (and this is the only one you accept).