C# 索引器

C# 索引器
.索引器的索引值不受限为整数
.索引器允许重载
.索引器不是一个变量

/**/ /*
 * 由 SharpDevelop 创建。
 * 用户: huy
 * 日期: 2010-2-28
 * 时间: 0:20
 
*/


using  System;
using  System.Threading;

public   class  Test
{
    
private string name;
    
private int age;
    
    
public string Name
    
{
        
get{return name;}
        
set{name = value;}
    }

    
    
public int Age
    
{
        
get{return age;}
        
set{age = value;}
    }

    
public static void Main()
    
{
        Test test 
= new Test();
        test.Name 
= "huyvanpull";
        test.Age 
= 25;
        
        Console.WriteLine(test.Name 
+ ";  " + test.Age);
        Thread.Sleep(
5000);
    }

}



你可能感兴趣的:(C# 索引器)