dotnet / dotnet/dotnet-api-docs
CallerMemberNameAttribute Undocumented Field/Property Initializer Behavior
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
If a method has a `CallerMemberName` parameter and it is called in a field initializer or implicit property initializer then it appears that the field/property name is passed into it and not the actual caller (i.e. the constructor / static constructor).
---
#### Document Details
*Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 5f7f45e1-b056-e4f2-110b-efb2b66a2015
* Version Independent ID: f53f0557-a258-f710-734a-6710bdd26c07
* Content: [CallerMemberNameAttribute Class (System.Runtime.CompilerServices)](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute?view=netframework-4.7.2)
* Content Source: [xml/System.Runtime.CompilerServices/CallerMemberNameAttribute.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Runtime.CompilerServices/CallerMemberNameAttribute.xml)
* Product: **dotnet-api**
* GitHub Login: @mairaw
* Microsoft Alias: **mairaw**
Contributor guide
Assessment
This issue has not been assessed yet.