C# Lazy Loaded Automatic Properties

前端 未结 12 2186
执笔经年
执笔经年 2020-12-04 11:08

In C#,

Is there a way to turn an automatic property into a lazy loaded automatic property with a specified default value?

Essentially, I am trying to turn th

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 11:46

    Not like that, parameters for attributes must be constant in value, you cannot call code (Even static code).

    You may however be able to implement something with PostSharp's Aspects.

    Check them out:

    PostSharp

提交回复
热议问题