In my new CF winform I suddenly cannot code int.TryParse()
, with VS showing the message 'int' does not contain a definition for 'TryParse'
, but in another form this is no problem. So strange!
I tracked this down, with Go To Definition, that the old form uses int
from C:\DOCUME~1\XPMUser\LOCALS~1\Temp\3464$CommonLanguageRuntimeLibrary$v2.0.50727\System.Int32.cs
which of course has TryParse()
, while my new code uses int
from C:\DOCUME~1\XPMUser\LOCALS~1\Temp\3464$mscorlib.dll$v2.0.50727\System.Int32.cs
, which has no TryParse()
.
In the list of references of the project, there is a mscorlib
, and by double-clicking I arrive in the Object Browser at mscorlib [Compact Framework]
, while the object browser also shows an entry mscorlib
, i.e. without the CF remark.
This did not help me much, hopefully someone can help me get TryParse() back.
Here is sample code with the error:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace SIClient2.WebServices
{
class Test
{
public Test()
{
int i;
int.TryParse("123", out i); // <== 'int' does not contain a definition for 'TryParse'
}
}
}
The code without the error is part of a winform. Does that make a diff?