Vs2008 provides a lot of snippets to improve the coding speed, some are inherited from vs2003 and vs 2005. I will summarize them in this tech article. usage: type snippet eg: ctor then press [Tab] key twice.
  • ctor + [TAB]: public no parameter constructor function
  • cw + [TAB]: Console.WriteLine();
  • prop + [TAB] : public int MyProperty { get; set; }, then revise the property type and name.
  • #region +[TAB]: #region MyRegion #endregion, revise MyRegion
  • #if +[TAB]: #if true #endif , revise True to what you want
  • for +[TAB]: for (int i = 0; i < length; i++){} , revise length to what you want, and add content in brankets
  • foreach +[TAB]: foreach (var item in collection){} , revise collectionto what you want, and add content in brankets
  • switch +[TAB]: switch (switch_on){default:} , revise switch_on what you want, and add content in brankets
  • try + [TAB]: try { } catch (Exception) { throw; }
  • indexer + [TAB]: public object this[int index] { get { /* return the specified index here */ } set { /* set the specified index to value here */ } }
posted on 2009-04-29 14:26  蔡春升  阅读(193)  评论(0编辑  收藏  举报