``this'' in C#
来源:互联网 发布:vb怎么建立数据库 编辑:程序博客网 时间:2024/05/16 11:40
When to use `this' in the code?
- To avoid the nameing scopes, e.g.
public class Rectangle:Shape{ public Rectangle(double Width, double Height):base(){ this.Width = Width; this.Height = Height; } }
If you have the parameters named as Width and Height, you have to use `this' to avoid ambiguity. Otherwise, you may neglect it as...
public class Rectangle:Shape{ public Rectangle(double w, double h):base(){ Width = w; Height = h; } }
To refer to the current instance, e.g.
public interface IIndex<out T>{ T this[int i]{get;} int Count{get;} }
and the implementation of the interface should refer to `this' as well...public Rectangle this[int i]{ get{ if(i<0||i>=data.Length){ throw new ArgumentOutOfRangeException("index"); } return data[i]; } }
阅读全文
0 0
- ``this'' in C#
- Refresher of IL explains "this pointer" in C#
- C# this
- c# this
- Use of “this” keyword in formal parameters for static methods in C#
- this in javascript
- 'this' in JS
- ‘this’ pointer in C++
- This in JavaScript
- this指针in C++
- this in Java
- ‘this’ pointer in C++
- Cannot access individual rows in this collection because the table has vertically merged cells c#
- c#中的this关键字
- C# 中的this
- c# this.tag错误????
- C# this base
- C# this关键字详解
- JS——[]==[]
- 【SpringMVC】快速入门(注解版本)(十)
- Eclipse安装svn插件的几种方式
- EventBus3.0详解
- dimens文件生成器
- ``this'' in C#
- 自用函数
- MDK 5.0支持4.0的方法 MDK V4 legacy support
- 【数据库】关系代数基本运算
- 2017年迪培思昆明国际广告标识及LED照明展会刊(参展商名录)
- SQL优化
- 数据库 order by varchar类型排序
- RecycleView初级使用
- linux中的typeof使用