The following are common code snippets from Visual Studio for memo shortcuts: EH uses: Class event implementation function templates
private void MyMethod(object sender, EventArgs e) { throw new NotImplementedException(); }
Shortcut keys: Xmethod has 4 uses: function templates for public static methods in classes
public static void MyMethod(this object value) { throw new NotImplementedException(); }
Shortcut keys: Method has 4 uses: a template for public functions in a class
public void MyMethod() { throw new NotImplementedException(); }
Shortcut keys: Seh use: function templates for private static methods in classes
private static void MyMethod(object sender, EventArgs e) { throw new NotImplementedException(); }
Shortcut keys: Smethod has 4 uses: function templates for public static methods in classes
public static void MyMethod() { throw new NotImplementedException(); }
Shortcut key: Vmethod has 4 uses: template of virtual function in class
public virtual void MyMethod() { throw new NotImplementedException(); }
Shortcut key: PROPDP Purpose: Define a template for dependency properties
public int MyProperty { get { return (int)GetValue(MyPropertyProperty); } set { SetValue(MyPropertyProperty, value); } } // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.Register("MyProperty", typeof(int), typeof(ownerclass), new PropertyMetadata(0));
Shortcut key: Propa Purpose: A template that defines additional properties
public static int GetMyProperty(DependencyObject obj) { return (int)obj.GetValue(MyPropertyProperty); } public static void SetMyProperty(DependencyObject obj, int value) { obj.SetValue(MyPropertyProperty, value); } // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.RegisterAttached("MyProperty", typeof(int), typeof(ownerclass), new PropertyMetadata(0));
Shortcut key: Wde use: Create a template for dependency property events in Windows Workflow mode
public static System.Workflow.ComponentModel.DependencyProperty InvokeEvent = System.Workflow.ComponentModel.DependencyProperty.Register("Invoke", typeof(EventHandler), typeof(Obj)); [System.ComponentModel.Description("Invoke")] [System.ComponentModel.Category("Invoke Category")] [System.ComponentModel.Browsable(true)] [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)] public event EventHandler Invoke { add { base.AddHandler(Obj.InvokeEvent, value); } remove { base.RemoveHandler(Obj.InvokeEvent, value); } }
Shortcut key: WDP
public static System.Workflow.ComponentModel.DependencyProperty MyPropertyProperty = System.Workflow.ComponentModel.DependencyProperty.Register("MyProperty", typeof(string), typeof(Obj)); [System.ComponentModel.Description("MyProperty")] [System.ComponentModel.Category("MyProperty Category")] [System.ComponentModel.Browsable(true)] [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)] public string MyProperty { get { return ((string)(base.GetValue(Obj.MyPropertyProperty))); } set { base.SetValue(Obj.MyPropertyProperty, value); } }
Shortcut key: TESTC use: Create a template for a test unit class of C #
[Microsoft.VisualStudio.TestTools.UnitTesting.TestClass] public class MyTestClass { }
Shortcut key: testm use: Add a test method to the test unit class in C #
[TestMethod] public void MyTestMethod() { }
C # Common Code snippet Memo