Using c# I would like to set the variables within a struct which is a member of a class, from within that class. Pretty new to c#. Help appreciated.
class myclass
{
public struct mystruct
{
public int something;
}
public void init()
{
mystruct.something = 20; // <-- this is an error
}
static void Main(string[] args)
{
myclass c = new myclass();
c.init();
}
}
Error: 'An object reference is required for the non-static field, method, or property myclass.mystruct.something'