110,552
社区成员
发帖
与我相关
我的任务
分享
Public Property XXX(i As Integer) As Integer
Get
End Get
Set(value As Integer)
End Set
End Property
public int this[int i]
{
get { }
set { }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace T392426871
{
class Class1
{
int[] arr = { 3, 7, 4, 6, 4, 5 };
public class XXXCollection
{
Class1 _instence;
public XXXCollection(Class1 ins)
{
_instence = ins;
}
public int this[int index]
{
get
{
return _instence.arr[index];
}
set
{
_instence.arr[index] = value;
}
}
}
public XXXCollection XXX { get { return new XXXCollection(this); } }
}
class Program
{
static void Main(string[] args)
{
Class1 c1 = new Class1();
Console.WriteLine(c1.XXX[1]);
c1.XXX[1] = 2;
Console.WriteLine(c1.XXX[1]);
}
}
}