How to determine if a field is a backup field of an automatically implemented property?

I use reflection to access and save properties and fields. However, in order to avoid redundant data, I want to get rid of the support fields for automatically implemented properties, which are also listed as regular fields. It looks like these support fields are called "{PropertyName] k_BackingField", and it seems to me that I could only do this with parsing this line, but I wonder if there is a better approach than relying on an internal, compiler broken name.

Thanks.

+3
source share
2 answers
+7

, , #. , , . , , , . , .

, , , , FieldInfo CompilerGeneratedAttribute . , - , , -, , - , , ( , ).

+5

Source: https://habr.com/ru/post/1720554/


All Articles