B
Beffmans
Hi
When I run this code:
using System;
namespace DelegateProject
{
public delegate void MyDelegate(string s);
class Class1
{
public void SayHello(string s)
{
Console.Write(s);
}
static void Main(string[] args)
{
MyDelegate MyInstDel = new MyDelegate(SayHello);
MyInstDel("Hello");
}
}
}
I get the error:
An object reference is required for the nonstatic field, method, or
property 'DelegateProject.Class1.SayHello(string)'
??
What could be wrong?
thanks
Bert Effmans
When I run this code:
using System;
namespace DelegateProject
{
public delegate void MyDelegate(string s);
class Class1
{
public void SayHello(string s)
{
Console.Write(s);
}
static void Main(string[] args)
{
MyDelegate MyInstDel = new MyDelegate(SayHello);
MyInstDel("Hello");
}
}
}
I get the error:
An object reference is required for the nonstatic field, method, or
property 'DelegateProject.Class1.SayHello(string)'
??
What could be wrong?
thanks
Bert Effmans