Given the follow contrived struct
public struct CarParts
{
public int trunk;
public int door;
}
Why do I get an error that says “cp might not be initialized before use” however if I do the exact same thing in a static method id doesnt work. Also why did it used to comple before I added the static method?
public void Test()
{
CarParts cp;
cp.trunk= 1;
cp.door= 4;
}
I guess that this is relevant to your question: