.Net中的this关键字区分成员字段和同名参数

这个纠结了好久,现以源码作为说明:

 1 View Code 
 2  using System;
 3  using System.Collections.Generic;
 4  using System.Linq;
 5  using System.Text;
 6  
 7  namespace DemoText
 8  {
 9      class Program
10      {
11          static void Main(string[] args)
12          {
13  
14  
15              Console.ReadKey();
16  
17          }
18          class MyNumber
19          {
20              private int number;
21              private MyNumber(int number)
22              {
23                  this.number = number;//this关键字用来区分成员字段和同名参数的。this.number指的的成员字段即(  private int number;)
24              }
25          }
26      }
27  }
原文地址:https://www.cnblogs.com/acoll/p/2553178.html