Why does the compiler not complain when we use struct function inside the static methods without defining them static?
Example:
struct CustomerName{
Public String firstname, lastname;
Public String Name() => firstname + " " +lastname;
}
Public static void main(){
CustomerName MyName ;
MyName.firstname = "Kidus";
MyName.lastname = "Tekeste";
Console.WriteLine(MyName.Name());
}
This works fine in visual studio but I wonder why it worked with out it being made static. like this:
static struct CustomerName{
Public String firstname, lastname;
Public String Name() => firstname + " " +lastname;
}