1 public interface IMyInterface
2 {
3 void Foo();
4 }
5
6 public abstract class MyGeneric<T> : T, IMyInterface
7 where T : class, new()
8 {
9 public virtual void Foo()
10 {
11 System.Console.WriteLine("Foo");
12 }
13 }
14
15
16 public class MyClass : MyGeneric<System.Text.StringBuilder>
17 {
18
19 }
1 public class C1
2 {
3 public virtual object A()
4 {
5 return null;
6 }
7 }
8
9 public class C2 : C1
10 {
11 public override string A()
12 {
13 return "foo";
14 }
15 }
1 public class C1
2 {
3 public virtual object A()
4 {
5 return null;
6 }
7 }
8
9 public class C2 : C1
10 {
11 public new virtual string A()
12 {
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="Some WPF menu fan ;)"
SizeToContent="WidthAndHeight"
>
<Window.Resources>
<x:Array x:Key="menuItemsArray" x:Type="sys:Object">
<MenuItem Header="MenuItem1"/>
<MenuItem Header="MenuItem2"/>
<Separator/>
<MenuItem Header="MenuItem3"/>
</x:Array>
</Window.Resources>
<StackPanel>
<Menu>
<MenuItem Header="MainMenu1"
ItemsSource="{StaticResource menuItemsArray}"/>
1 using System;
2 using System.Windows;
3 using System.Windows.Controls;
4
5 public class Demo
6 {
7 private static MenuItem setHeader(MenuItem i, object h)
8 {
9 i.Header = h;
10 return i;
11 }
12
13 [STAThread]
14 public static void Main()
15 {
16 object[] list = new object[21];
17 for(int i=0;i<list.Length;++i)
18 list[i] = i%2==0?(object)setHeader(new MenuItem(), "Item №" + (i/2 +1)):(new Separator());
19
20 Window w = new Window();
21 w.Title = "WPF fan";
22 w.SizeToContent = SizeToContent.WidthAndHeight;
23 StackPanel sp = new StackPanel();
24 Menu m = new Menu();
1 using System.Diagnostics;
2
3 namespace dimzon.CompilerTest
4 {
5 public interface i1
6 {
7 void a();
8 }
9
10 public class c1: i1
11 {
12 public void a()
13 {
14 Trace.WriteLine(this + " a()");
15 }
16 }
17
18 public class c2: i1
19 {
20 public void a()
21 {
22 Trace.WriteLine(this + " a()");
23 }
24 }
25
26 public abstract class c3
27 {
28 private void test_method(string str, i1[] arr,
1 using System;
2 using System.Collections.Generic;
3 using System.Windows;
4 using System.Windows.Controls;
5
6 public class MyMenuItem: MenuItem
7 {
8 private static MenuItem setHeader(MenuItem i, object h)
9 {
10 i.Header = h;
11 return i;
12 }
13
14 private static List<Control> createItems()
15 {
16 List<Control> list = new List<Control>();
17 list.Add(setHeader(new MenuItem(), "MenuItem 1"));
18 list.Add(new Separator());
19 list.Add(setHeader(new MenuItem(), "MenuItem 2"));
20 list.Add(new Separator());
21 list.Add(setHeader(new MyMenuItem(), "MyMenuItem"));
22 list.Add(new Separator());
1 using System.Collections.Generic;
2 using System.ComponentModel;
3 using System.Reflection;
4 using System;
5 using PostSharp.Extensibility;
6 using PostSharp.Laos;
7
8 public class Demo1: INotifyPropertyChanged
9 {
10 #region Вспомогательный код, может быть реализован в базовом классе
11 public event PropertyChangedEventHandler PropertyChanged;
12 protected void raisePropertyChanged(string propertyName)
13 {
14 if(PropertyChanged!=null)
15 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
16 }
17 protected void raisePropertyChanged(PropertyChangedEventArgs ea)
18 {
19 if (PropertyChanged != null)
20 PropertyChanged(this, ea);
21 }
22 #endregion
1 using System;
2 using System.Collections.Generic;
3 using System.Reflection;
4 using System.Windows;
5 using PostSharp.Extensibility;
6 using PostSharp.Laos;
7
8 namespace PostSharpDemo
9 {
10 /// <summary>
11 /// Классическая реализация 2-х свойств
12 /// </summary>
13 public class ClassicImplementation: DependencyObject
14 {
15 public static readonly DependencyProperty DemoStringProperty =
16 DependencyProperty.Register(
17 "DemoString",
18 typeof (string), typeof (ClassicImplementation),
19 new