Consider this code block:

struct Animal
{
    public string name = ""; // Error
    public static int weight = 20; // OK

    // initialize the non-static field here
    public void FuncToInitializeName()
    {
        name = ""; // Now correct
    }
}
  • Why can we initialize a static field inside a struct but not a non-static field?
  • Why do we have to initialize non-static in methods bodies?
Edit
Report