The following code is being produced in CodeDom. When I set the target framework to .net 4.0 it works fine – no errors or warnings. When I set the target framework to .net 2.0, I get the following error:
CS1526: A new expression requires () or [] after type
test soVar;
soVar = new test { foo = 0x10007 }; // Error occurs on this line
[StructLayout(LayoutKind.Sequential)]
struct test
{
public uint foo;
}
What is going on here?! Why would switching to .net 2.0 all of the sudden raise an error?
Look forward to any ideas here.
Thanks,
Evan
.net 2.0 does not support object initializers. it will have to do