Skip to content

Instantly share code, notes, and snippets.

@c1982
Created March 5, 2011 22:09
Show Gist options
  • Save c1982/856761 to your computer and use it in GitHub Desktop.
Save c1982/856761 to your computer and use it in GitHub Desktop.
DynamicOverload Pattern
class Program
{
static void Main(string[] args)
{
var cmd = new Executor();
dynamic commandItem = RemoteServer.GetCommandItemFromRemoteServer(); //return Object;
cmd.ExecuteCommand(commandItem);
Console.ReadKey();
}
class Executor
{
public void ExecuteCommand(int commandItem)
{
Console.WriteLine("This is integer method.");
}
public void ExecuteCommand(string commandItem)
{
Console.WriteLine("This is string method ");
}
public void ExecuteCommand(List<string> commandItem)
{
Console.WriteLine("This is List<string> method ");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment