For example I have these two classes:
First
public class Example
{
public Example()
{
}
public int ReturnSomething
{
return 1;
}
}
Second
public class Example
{
public Example()
{
}
public static int ReturnSomething
{
return 1;
}
}
I want to use the ReturnSomething
method, which of the two classes allocated less/more memory? When I use
int x = Example.ReturnSomething;
or when I use
Example object = new Example();
int x = object.ReturnSomething();