(c) 2002 Visual Studio Magazine 
Fawcette Technical Publications

Issue: October 2002
Section: Q&A
Author: Juval Lowy, Mattias Sjogren

C#	Implement Interfaces Automatically
Listing 1	VS.NET generates skeletal implementation, enclosed in a code region. The wizard-generated code compiles because the skeleton returns default values from the methods. It even provides a comment, visible as a tool tip when hovering over the collapsed region.

public interface IMyInterface
{
	void Method1();
	int Method2(int num);
	string Method3();
}
//Visual Studio.NET will generate this skeletal 
//implementation:
public class MyClass : IMyInterface
{
	#region Implementation of IMyInterface
	public void Method1()
	{
	}
	public int Method2(int num)
	{
		return 0;
	}
	public string Method3()
	{
		return null;
	}
	#endregion
}
