Vb.net to C# conversion Error cs0103

后端 未结 2 1415
小蘑菇
小蘑菇 2021-01-29 11:50

\"VB.net

\"C#

I have made a conversion

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-29 12:15

    That is a VB "parameterized property" - there is no direct C# equivalent. The closest equivalent in C# is to make it a regular method (which is called the same if the original parameterized property only has a 'get'):

    public Ship GetShip(ShipName name)
    {
        if (name == ShipName.None)
            return null;
        else
            return _Ships[name];
    }
    

提交回复
热议问题