The Labs \ Source Viewer \ SSCLI \ System.Reflection \ DefaultMemberAttribute

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. ////////////////////////////////////////////////////////////////////////////////
  16. ////////////////////////////////////////////////////////////////////////////////
  17. //
  18. // DefaultMemberAttribute is defines the Member of a Type that is the "default"
  19. // member used by Type.InvokeMember. The default member is simply a name given
  20. // to a type.
  21. //
  22. //
  23. //
  24. //
  25. namespace System.Reflection
  26. {
  27.    
  28.     using System;
  29.    
  30.     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface), Serializable()]
  31.     [System.Runtime.InteropServices.ComVisible(true)]
  32.     public sealed class DefaultMemberAttribute : Attribute
  33.     {
  34.         // The name of the member
  35.         private string m_memberName;
  36.        
  37.         // You must provide the name of the member, this is required
  38.         public DefaultMemberAttribute(string memberName)
  39.         {
  40.             m_memberName = memberName;
  41.         }
  42.        
  43.         // A get accessor to return the name from the attribute.
  44.         // NOTE: There is no setter because the name must be provided
  45.         // to the constructor. The name is not optional.
  46.         public string MemberName {
  47.             get { return m_memberName; }
  48.         }
  49.     }
  50. }

Developer Fusion