Java version http://www.engineeringser...rface_how_to-t2882.0.htmlc# versionInterface1.cs
GeSHi (csharp):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ComputerInterfaceDemo
{
interface IComputerInterface
{
void startUp();
void shutDown();
}
}
Created by GeSHI 1.0.7.20
Program.cs
GeSHi (csharp):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ComputerInterfaceDemo
{
class Program : IComputerInterface
{
static void Main(string[] args)
{
Program p =
new Program
();
p.startUp();
p.shutDown();
Console.Read();
}
public void startUp()
{
Console.WriteLine("Start up");
}
public void shutDown()
{
Console.WriteLine("Shut down");
}
}
}
Created by GeSHI 1.0.7.20
As you can see, not much difference between Java and c# except in Java you use the "implements" keyword to implement the interface while in c# you do this with a ":" and the Interface should start with "I" as in "IComputerInterface", this is a c# naming convention but it's not required to name Interfaces with a capital I but however i would recommend to start all interfaces with a capital I.