C# Member variable overrides used by base class method

前端 未结 5 926
刺人心
刺人心 2021-01-06 00:21

OK so I admit right off the top that this is a bit screwy … but it does serve a logical purpose. I’m using C# for a current project and I’m trying to find a way to override

5条回答
  •  自闭症患者
    2021-01-06 00:37

    Is there any reason you can't use a virtual property? That would provide exactly the functionality you are looking for. It just wouldn't be a field.

    protected abstract string[] array { get; }
    

    ...

    protected override string[] array { get { return new string[]{"...","..."}; }}
    

提交回复
热议问题