Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var parent = new Person { Name = "parent" };
            var child = new Person { Name = "child" };

            parent.AddChild(child);

            parent.ToAge += (object s, RoutedEventArgs e) =>
            {
                Console.WriteLine(((Person)e.Source).Name);
            };

            parent.RaiseEvent(new RoutedEventArgs(Person.ToAgeEvent));
            child.RaiseEvent(new RoutedEventArgs(Person.ToAgeEvent));
        }
Exemplo n.º 2
0
 // 子を追加するメソッド
 public void AddChild(Person child)
 {
     this.AddLogicalChild(child);
 }