G
Guest
Dear all,
Until now I was programing for more that 6 years using VB.net simply because
I come from that word and used to. Now I need to switch to C# simply because
my customer want its project in that language. So now I am fighting with so
simple thing like raising a simple event as follow, and have a complie error,
with no damn idea what this compiler want.
The code is as follow
------>
namespace ConsoleApplication1
{
public delegate void dg_Startup();
class Program
{
public event dg_Startup StartupComplete;
static void Main(string[] args)
{
Console.WriteLine("Initiliastion");
Console.Write("completetd...");
StartupComplete;
Console.ReadLine;
}
}
}
<-------
The two last line of my main are highligtied with error saying :
Error 1 Only assignment, call, increment, decrement, and new object
expressions can be used as a statement D:\Users\Serge\Documents\Visual Studio
2005\Projects\WindowsService1\ConsoleApplication1\Program.cs 18 10 ConsoleApplication1
Error 2 An object reference is required for the nonstatic field, method, or
property
'ConsoleApplication1.Program.StartupComplete' D:\Users\Serge\Documents\Visual
Studio
2005\Projects\WindowsService1\ConsoleApplication1\Program.cs 18 10 ConsoleApplication1
Thnaksa for help
serge
Until now I was programing for more that 6 years using VB.net simply because
I come from that word and used to. Now I need to switch to C# simply because
my customer want its project in that language. So now I am fighting with so
simple thing like raising a simple event as follow, and have a complie error,
with no damn idea what this compiler want.
The code is as follow
------>
namespace ConsoleApplication1
{
public delegate void dg_Startup();
class Program
{
public event dg_Startup StartupComplete;
static void Main(string[] args)
{
Console.WriteLine("Initiliastion");
Console.Write("completetd...");
StartupComplete;
Console.ReadLine;
}
}
}
<-------
The two last line of my main are highligtied with error saying :
Error 1 Only assignment, call, increment, decrement, and new object
expressions can be used as a statement D:\Users\Serge\Documents\Visual Studio
2005\Projects\WindowsService1\ConsoleApplication1\Program.cs 18 10 ConsoleApplication1
Error 2 An object reference is required for the nonstatic field, method, or
property
'ConsoleApplication1.Program.StartupComplete' D:\Users\Serge\Documents\Visual
Studio
2005\Projects\WindowsService1\ConsoleApplication1\Program.cs 18 10 ConsoleApplication1
Thnaksa for help
serge