A
Anonymous
Which is the recommended way in C# to test if an object is of type string?
In VB.NET I wrote "If TypeOf obj Is String Then".
That meets the requirements:
1. You don't have to instance an object.
2. Doesn't throw exception if obj is null.
I havn't found any solution to that in C#. Does it exist any simple syntax?
In VB.NET I wrote "If TypeOf obj Is String Then".
That meets the requirements:
1. You don't have to instance an object.
2. Doesn't throw exception if obj is null.
I havn't found any solution to that in C#. Does it exist any simple syntax?