示例#1
0
        // From here an extension method is in place and the class will have access to that function when called as normal. Note they do have to be in the same namespace, but not necessarily the same file.

        // This method is added to everything that uses the CanRun interface though!
        public static double MarathonDistance(this CanRun creature)
        {
            creature.Run();
            Console.WriteLine("I'm running a marathon!");
            return(26.2);
        }
示例#2
0
 public override int GetHashCode()
 {
     return(CanRun.GetHashCode());
 }