The Labs \ Source Viewer \ SSCLI \ System.ComponentModel \ InstallerTypeAttribute

  1. //------------------------------------------------------------------------------
  2. // <copyright file="InstallerTypeAttribute.cs" company="Microsoft">
  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. // </copyright>
  14. //------------------------------------------------------------------------------
  15. /*
  16. */
  17. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2113:SecureLateBindingMethods", Scope = "member", Target = "System.ComponentModel.InstallerTypeAttribute.get_InstallerType():System.Type")]
  18. namespace System.ComponentModel
  19. {
  20.     using System.Diagnostics;
  21.     using System.Security.Permissions;
  22.    
  23.     /// <devdoc>
  24.     /// <para>Specifies the installer
  25.     /// to use for a type to install components.</para>
  26.     /// </devdoc>
  27.     [AttributeUsage(AttributeTargets.Class)]
  28.     public class InstallerTypeAttribute : Attribute
  29.     {
  30.         string _typeName;
  31.        
  32.         /// <devdoc>
  33.         /// <para>Initializes a new instance of the System.Windows.Forms.ComponentModel.InstallerTypeAttribute class.</para>
  34.         /// </devdoc>
  35.         public InstallerTypeAttribute(Type installerType)
  36.         {
  37.             _typeName = installerType.AssemblyQualifiedName;
  38.         }
  39.        
  40.         /// <devdoc>
  41.         /// <para>[To be supplied.]</para>
  42.         /// </devdoc>
  43.         public InstallerTypeAttribute(string typeName)
  44.         {
  45.             _typeName = typeName;
  46.         }
  47.        
  48.         /// <devdoc>
  49.         /// <para> Gets the
  50.         /// type of installer associated with this attribute.</para>
  51.         /// </devdoc>
  52.         public virtual Type InstallerType {
  53.             get { return Type.GetType(_typeName); }
  54.         }
  55.        
  56.         public override bool Equals(object obj)
  57.         {
  58.             if (obj == this) {
  59.                 return true;
  60.             }
  61.            
  62.             InstallerTypeAttribute other = obj as InstallerTypeAttribute;
  63.            
  64.             return (other != null) && other._typeName == _typeName;
  65.         }
  66.        
  67.         public override int GetHashCode()
  68.         {
  69.             return base.GetHashCode();
  70.         }
  71.     }
  72. }

Developer Fusion