Skip to content

Instantly share code, notes, and snippets.

@kawa-xxx
Created March 30, 2014 15:42
Show Gist options
  • Save kawa-xxx/9874611 to your computer and use it in GitHub Desktop.
Save kawa-xxx/9874611 to your computer and use it in GitHub Desktop.
Explicit Interface Implementation
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
var hogeFuga = new HogeFuga();
var hoge = (IHoge) hogeFuga;
var fuga = (IFuga) hogeFuga;
Console.WriteLine(hoge.Do());
Console.WriteLine(fuga.Do());
}
}
public class HogeFuga : IHoge, IFuga
{
string IHoge.Do()
{
return "HogeDo!";
}
string IFuga.Do()
{
return "FugaDo!";
}
}
interface IHoge
{
string Do();
}
interface IFuga
{
string Do();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment