[Mono-list] mcs won't allow implementation of interfaces with static methods

Martin Baulig martin@gnome.org
15 Aug 2002 01:36:05 +0200


"Jeroen Frijters" <mono@jeroen.nu> writes:

> When I have a C# class that tries to implement an interface (created
> with ILASM) that contains a static method, mcs gives an error saying
> that I should implement the static method (which obviously doesn't make
> sense).

Hi,

I don't understand what you're trying to do: static methods are not
allowed on interfaces, that'd be an error CS0106.  MCS currently
doesn't report that error but abort with a parsing error instead since
its parser won't recognize `static' as a keyword if it's used on an
interface method.

====
using System;

interface A
{
	static void Test ();
}

class X : A
{
	public static void Test ()
	{
	}

	static void Main ()
	{
	}
}
====

-- 
Martin Baulig
martin@gnome.org