Two delegate variables aren't equal.
using System;
delegate void Printer();
delegate void Display();
class Test
{
static void consolePrinter()
{
Console.WriteLine("hi");
}
static void Main()
{
Printer p = consolePrinter;
Display d = p;
}
}
Compile time error.
C:\g>csc Program.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
Program.cs(15,21): error CS0029: Cannot implicitly convert type 'Printer' to 'Display'
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |