Try adding
static
like this :
public static void createStack(object value)
{
stack S = new stack();
head = new Node();
head.Cont = value;
size++;
}
or using your class as follows if
static
is not what you need and your class has state :
var s = new stack();
s.createStack(40);