_Xthanus_
2021-11-07 23:51:19浏览 944
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
fist fi = new fist();
fi[1] = "xxx";
Console.WriteLine(fi[1]);
Console.ReadLine();
}
}
public class fist
{
private string City = "广州";
private string SecondCity = "佛山";
public string this[int index]
{
get
{
if (index == 1)
{
return City;
}
else if (index == 2)
{
return SecondCity;
}
return "";
}
set {
if (index == 1)
{
City = value;
}
else if (index == 1)
{
SecondCity = value;
}
}
}
}
}