Is read-only auto-implemented property possible?

后端 未结 7 1607
你的背包
你的背包 2020-12-15 02:34

I found a topic on MSDN that talks that yes, this is possible.

I did a test that seems to break this statement:

using System;

namespace Test
{
    c         


        
相关标签:
7条回答
  • 2020-12-15 03:15

    No, it's not possible to make an auto-implemented property readonly. For the page you linked:

    with auto-implemented properties, both a get and set accessor are required

    A read-only property has NO set accessor.

    A property without a set accessor is considered read-only

    0 讨论(0)
提交回复
热议问题