CallerMemberName in .NET 4.0 not working

后端 未结 3 2060
悲哀的现实
悲哀的现实 2021-02-05 06:17

I am trying to use CallerMemberName attribute in .NET 4.0 via BCL portability pack. It is always returning an empty string instead of the member name. What am I doi

3条回答
  •  被撕碎了的回忆
    2021-02-05 06:27

    Targeting 4.0 works just fine if you add:

    namespace System.Runtime.CompilerServices {
        sealed class CallerMemberNameAttribute : Attribute { }
    }
    

提交回复
热议问题