Peter Chan
asked on
Problem with DataType
Hi,
How to resolve this
Error 4 'string' does not contain a definition for 'DataType' and no extension method 'DataType' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) C:\App16\Default.aspx.cs 64 24 App16
due to this line?
How to resolve this
Error 4 'string' does not contain a definition for 'DataType' and no extension method 'DataType' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) C:\App16\Default.aspx.cs 64 24 App16
due to this line?
if (!(str1.DataType==typeof(int)))
...
ASKER
No, I did declare str1 as a string above. How to correct my codes above?
What are you trying to do? I don't see the point of comparing a string variable's type to see if it is of type string--it will always be a string. What is your goal here?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
int i = 0;
// Prints True for any value of i
Console.WriteLine(i.GetTyp