[Mono-devel-list] casting method to delegates compiles

Matthias Kempka lists at mkempka.de
Wed Jun 23 14:05:56 EDT 2004

Hi everybody,

I found that the following code does compile on mcs 0.95 and mcs 0.96, 
but it does not compile with the Microsoft compiler csc. I thought, C# 
was standardised, so isn't one of the compilers doing something wrong?

using System;

namespace MyNameSpace {

   public class MyClass {

	private delegate void MyDelegate();
	public static void Main() {
	  new MyClass().Go();

   	private void Go() {
	  DoSomething(SomeMethod as MyDelegate);

	private void SomeMethod() {
	  Console.WriteLine("Hello World!");

	private void DoSomething(MyDelegate del) {

   } // end class MyClass

}// end namespace MyNameSpace


More information about the Mono-devel-list mailing list