示例#1
0
        static void Delegates()
        {
            SimplePerson person = new SimplePerson("Rowan", "Atkinson");

            person.FormattedPrint(SimplePerson.FormatFirstName);
            person.FormattedPrint(SimplePerson.FormatFormalName);
            person.FormattedPrint(p => "Mr. " + p.LastName);
        }
示例#2
0
 public static string FormatFirstName(SimplePerson person)
 {
     return(person.FirstName);
 }
示例#3
0
 public static string FormatFormalName(SimplePerson person)
 {
     return(person.LastName + ", " + person.FirstName);
 }