Skip to content

Instantly share code, notes, and snippets.

@markusjohnsson
Created January 26, 2015 15:53
Show Gist options
  • Save markusjohnsson/484802537b90b51e6e89 to your computer and use it in GitHub Desktop.
Save markusjohnsson/484802537b90b51e6e89 to your computer and use it in GitHub Desktop.
Illustrating the problem with named parameters and interfaces
using System;
class Coord : ICoord
{
public void Print(double lat, double lon)
{
Console.WriteLine("Lon: {0}, Lat: {1}", lon, lat);
}
}
interface ICoord
{
void Print(double lon, double lat);
}
public class Program
{
public static void Main()
{
Coord coord = new Coord();
coord.Print(lat: 11, lon: 44);
ICoord icoord = (ICoord)coord;
icoord.Print(lat: 11, lon: 44);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment