散分200,请教一个小问题. (100散分,另外100给正确答案者)
在C#编码规范中,有这么一条建议:
Do not use the this reference unless invoking another constructor from within a constructor.
// 除非在构造函数中调用另一个构造函数,否则不用使用this。
//Example of proper use of this
public class MyClass
{
public MyClass(string message)
{}
public MyClass() : this("hello")
{}
}
在此我不是很理解,为什么不提倡使用this呢,我觉得在调用类自身方法和变量时使用this.method, this.variable 看起来不仅直观,而且IDE有自动完成功能非常方便.我这样的编码习惯会导致那些不利后果吗?
有经验者请谈谈你的意见.
路过的朋友顺便也帮顶一下