CSharpCodeProvider fails to compile function but Visual studio compiles the same function
Here's a simple function. Compiling t开发者_如何学运维his code using the CSharpCodeProvider fails but it works when I attempt to reproduce the problem using Visual studion. The error I get is "unable to implicitly convert uint? to uint". Any ideas ?
public static Boolean Func1() { UInt32? x = 0; UInt32? y = 0; return x == (UInt32?)0; }
Which version of VS are you using? I guess VS 2008.
Have you tried to force the compiler version to be used? IIRIC, by default C# 2.0 will be used (even in a C# 3.0 app).
For more information see here.
精彩评论