ylbtech-C#-片段-插入片段:Visual C#
1.返回顶部

·#if

#if true

#endif

·#region

#region MyRegion

#endregion

·

2.返回顶部

·namespace

namespace MyNamespace
{ }

·class

class MyClass
{ }

·interface

interface IInterface
{ }

·struct

struct MyStruct
{ }

·ator

public Class1()
{ }

· sim

static int Main( string[] args )
{ return ;
}

·svm

static void Main( string[] args )
{ }

·index

public object this[int index]
{
get { /* return the specified index here */ }
set { /* set the specified index to value here */ }
}

·iterindex

public MyViewIterator MyView
{
get
{
return new MyViewIterator( this );
}
} public class MyViewIterator
{
readonly MyViewIterator outer; internal MyViewIterator( MyViewIterator outer )
{
this.outer = outer;
} // TODO: provide an appropriate implementation here
public int Length { get { return ; } } public ElementType this[int index]
{
get
{
//
// TODO: implement indexer here
//
// you have full access to MyViewIterator privates
// throw new NotImplementedException();
return default( ElementType );
}
} public System.Collections.Generic.IEnumerator<ElementType> GetEnumerator()
{
for( int i = ; i < this.Length; i++ )
{
yield return this[i];
}
}
}

·iterator

public System.Collections.Generic.IEnumerator<ElementType> GetEnumerator()
{ throw new NotImplementedException();
yield return default( ElementType );
}

··enum

enum MyEnum
{ }

·attibute

[System.AttributeUsage( AttributeTargets.All, Inherited = false, AllowMultiple = true )]
sealed class MyAttribute : Attribute
{
// See the attribute guidelines at
// http://go.microsoft.com/fwlink/?LinkId=85236
readonly string positionalString; // This is a positional argument
public MyAttribute( string positionalString )
{
this.positionalString = positionalString; // TODO: Implement code here throw new NotImplementedException();
} public string PositionalString
{
get { return positionalString; }
} // This is a named argument
public int NamedInt { get; set; }
}

·equals

// override object.Equals
public override bool Equals( object obj )
{
//
// See the full list of guidelines at
// http://go.microsoft.com/fwlink/?LinkID=85237
// and also the guidance for operator== at
// http://go.microsoft.com/fwlink/?LinkId=85238
// if( obj == null || GetType() != obj.GetType() )
{
return false;
} // TODO: write your implementation of Equals() here
throw new NotImplementedException();
return base.Equals( obj );
} // override object.GetHashCode
public override int GetHashCode()
{
// TODO: write your implementation of GetHashCode() here
throw new NotImplementedException();
return base.GetHashCode();
}

·using

using(resource)
{ }

·

3.返回顶部

·if

if (true)
{ }

·else

else
{ }

·while

while (true)
{ }

·do

do
{ } while (true);

··switch

switch (switch_on)
{
default:
}

·for

for (int i = ; i<length; i++)
{ }

·forr

for (int i = length - ; i >=  ; i--)
{ }

·foreach

foreach (var item in collection)
{ }

·

4.返回顶部

·try

try
{ }
catch (global::System.Exception)
{ throw;
}

·tryf

try
{ }
finally
{ }

·exception

[Serializable]
public class MyException : Exception
{
public MyException() { }
public MyException( string message ) : base( message ) { }
public MyException( string message, Exception inner ) : base( message, inner ) { }
protected MyException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context ) : base( info, context ) { }
}

·

5.返回顶部
·unsafe
unsafe
{ }

·checked

checked
{ }

·unchecked

unchecked
{ }

·lock

lock (this)

{

}

··invoke

EventHandler temp = MyEvent;
if (temp != null)
{
temp();
}

·

·~

~Class1()
{ }

·

6.返回顶部

·prop

public int MyProperty { get; set; }

·propfull

private int myVar;

public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}

·propg

public int MyProperty { get; private set; }

·
··
·cw

Console.WriteLine();

·mbox

System.Windows.Forms.MessageBox.Show("Test");

·

作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

C#-片段-插入片段:Visual C#的更多相关文章

  1. C#-片段-插入片段:测试

    ylbtech-C#-片段-插入片段:测试 using Microsoft.VisualStudio.TestTools.UnitTesting; 1.返回顶部 ·测试方法 [Microsoft.Vi ...

  2. Visual Studio使用技巧,创建自己的代码片段

    1.代码片段的使用示例 在编写代码中常会使用代码片段来提高我们的编写代码的效率,如:在Visual Studio中编写一个 for(int i = 0; i < length;i++) { } ...

  3. visual studio制作代码片段

    使用 Visual Studio 的代码片段功能,我们可以快速根据已有模板创建出大量常用的代码出来.ReSharper 已经自带了一份非常好用的代码片段工具,不过使用 ReSharper 创建出来的代 ...

  4. Visual Studio 2010 中的 Web 开发

    概述 Microsoft Visual Studio 2010 为 ASP.NET Web 应用程序的开发提供非常多新的功能.这些新功能旨在帮助开发者高速方便地创建和部署质量高且功能全的 Web 应用 ...

  5. JavaScript中的Array.prototype.slice.call()方法学习

    JavaScript中的Array.prototype.slice.call(arguments)能将有length属性的对象转换为数组(特别注意: 这个对象一定要有length属性). 但有一个例外 ...

  6. Visual Studio 如何使用代码片段Code Snippet提高编程速度!!!

      使用Code Snippet简化Coding 在开发的项目的时候,你是否经常遇到需要重复编写一些类似的代码,比如是否经常会使用 for.foreach ? 在编写这两个循环语句的时候,你是一个字符 ...

  7. Visual Studio 的代码片段工具

    当安装完Visual Studio之后,会有附带一些原生的代码片段文件(*.snippet),对于vs2013参考目录如下: X:\Program Files (x86)\Microsoft Visu ...

  8. [搬运] 将 Visual Studio 的代码片段导出到 VS Code

    原文 : A Visual Studio to Visual Studio Code Snippet Converter 作者 : Rick Strahl 译者 : 张蘅水 导语 和原文作者一样,水弟 ...

  9. visual studio code开发代码片段扩展插件

    背景 visual studio code编辑器强大在于可以自己扩展插件,不仅可以去插件市场下载,也可以按照官方的API很方便的制作适合自己的插件: 自己最近在开发一个手机端网站项目,基于vant项目 ...

随机推荐

  1. HTTP 协议部分常识简介

    1.状态码 具体的状态码可以百度查找,但是对于状态码的大致分类有一个清楚的了解 1XX   ----信息状态码------接受的请求正在处理 2XX ------成功状态码 ------请求正常处理完 ...

  2. MySQL进阶11--DDL数据库定义语言--库创建/修改/删除--表的创建/修改/删除/复制

    /*进阶 11 DDL 数据库定义语言 库和表的管理 一:库的管理:创建/修改/删除 二:表的管理:创建/修改/删除 创建: CREATE DATABASE [IF NOT EXISTS] 库名; 修 ...

  3. 数据库中聚合索引(MySQL和SQL Server区别)

    一.聚集索引和非聚集索引 聚集索引:类似字典的拼音目录.表中的数据按照聚集索引的规则来存储的.就像新华字典.整本字典是按照A-Z的顺序来排列.这也是一个表只能有一个聚集索引的原因.因为这个特点,具体索 ...

  4. 前端学习笔记--CSS样式--文本

    1.文本与文字样式主要的属性: 子标签可以继承父标签的样式: 关于颜色: 文本属性: letter-spacing: line-height: text-align: 字体:

  5. Tomcat 配置及优化

    Tomcat配置优化,主要在于优化tomcat运行模式,并发参数和线程数, 以及jvm堆内存和垃圾回收相关参数的优化.下面将逐一介绍. 1. tomcat的3种运行模式 1.1 BIO - 同步阻塞I ...

  6. Selenium常用API的使用java语言之1-环境安装之Java

    (一)环境安装之Java 1.安装java 点击 JDK8下载,根据自己的平台,选择相应的版本进行下载. 小知识: Java环境分JDK和JRE ,JDK就是Java Development Kit. ...

  7. dell 7559 安装Manjaro 18

    本来是装黑苹果的,折腾好几天都装好了,是可以正常使用的,可是clover始终有一个问题,每次启动前需要覆盖一遍EFI分区内EFI目录的CLOVER目录内的所有文件,方能引导MAC. 不然就卡Init ...

  8. MySQL 日期、字符串、时间戳互转

    背景 原文地址:https://www.cnblogs.com/jhy-ocean/p/5560857.html 平时比较常用的时间.字符串.时间戳之间的互相转换,虽然常用但是几乎每次使用时候都喜欢去 ...

  9. vue app.xxx.js 较大问题

    线上build之后发现app.XXX.js 文件特别大. 包我都改为cdn了 其他空间就是路由改为懒加载了. { path: '/a/b', name: 'ab', component: () =&g ...

  10. 编写一个求圆面积的C语言程序

    #include<stdio.h>   //文件包含//#define PI 3.14     //宏定义//void main()         { float r,s; scanf( ...