2
0

DefaultMemberAttribute.cs 829 B

123456789101112131415161718192021
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Reflection
  5. {
  6. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
  7. public sealed class DefaultMemberAttribute : Attribute
  8. {
  9. // You must provide the name of the member, this is required
  10. public DefaultMemberAttribute(string memberName)
  11. {
  12. MemberName = memberName;
  13. }
  14. // A get accessor to return the name from the attribute.
  15. // NOTE: There is no setter because the name must be provided
  16. // to the constructor. The name is not optional.
  17. public string MemberName { get; }
  18. }
  19. }