Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / DesignerAttribute.cs / 1305376 / DesignerAttribute.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
///
/// Specifies the class to use to implement design-time services.
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
public sealed class DesignerAttribute : Attribute {
private readonly string designerTypeName;
private readonly string designerBaseTypeName;
private string typeId;
///
///
/// Initializes a new instance of the class using the name of the type that
/// provides design-time services.
///
///
public DesignerAttribute(string designerTypeName) {
string temp = designerTypeName.ToUpper(CultureInfo.InvariantCulture);
Debug.Assert(temp.IndexOf(".DLL") == -1, "Came across: " + designerTypeName + " . Please remove the .dll extension");
this.designerTypeName = designerTypeName;
this.designerBaseTypeName = typeof(IDesigner).FullName;
}
///
///
/// Initializes a new instance of the class using the type that provides
/// design-time services.
///
///
public DesignerAttribute(Type designerType) {
this.designerTypeName = designerType.AssemblyQualifiedName;
this.designerBaseTypeName = typeof(IDesigner).FullName;
}
///
///
/// Initializes a new instance of the class using the designer type and the
/// base class for the designer.
///
///
public DesignerAttribute(string designerTypeName, string designerBaseTypeName) {
string temp = designerTypeName.ToUpper(CultureInfo.InvariantCulture);
Debug.Assert(temp.IndexOf(".DLL") == -1, "Came across: " + designerTypeName + " . Please remove the .dll extension");
this.designerTypeName = designerTypeName;
this.designerBaseTypeName = designerBaseTypeName;
}
///
///
/// Initializes a new instance of the class, using the name of the designer
/// class and the base class for the designer.
///
///
public DesignerAttribute(string designerTypeName, Type designerBaseType) {
string temp = designerTypeName.ToUpper(CultureInfo.InvariantCulture);
Debug.Assert(temp.IndexOf(".DLL") == -1, "Came across: " + designerTypeName + " . Please remove the .dll extension");
this.designerTypeName = designerTypeName;
this.designerBaseTypeName = designerBaseType.AssemblyQualifiedName;
}
///
///
/// Initializes a new instance of the class using the types of the designer and
/// designer base class.
///
///
public DesignerAttribute(Type designerType, Type designerBaseType) {
this.designerTypeName = designerType.AssemblyQualifiedName;
this.designerBaseTypeName = designerBaseType.AssemblyQualifiedName;
}
///
///
/// Gets
/// the name of the base type of this designer.
///
///
public string DesignerBaseTypeName {
get {
return designerBaseTypeName;
}
}
///
///
/// Gets the name of the designer type associated with this designer attribute.
///
///
public string DesignerTypeName {
get {
return designerTypeName;
}
}
///
///
///
/// This defines a unique ID for this attribute type. It is used
/// by filtering algorithms to identify two attributes that are
/// the same type. For most attributes, this just returns the
/// Type instance for the attribute. DesignerAttribute overrides
/// this to include the type of the designer base type.
///
///
public override object TypeId {
get {
if (typeId == null) {
string baseType = designerBaseTypeName;
int comma = baseType.IndexOf(',');
if (comma != -1) {
baseType = baseType.Substring(0, comma);
}
typeId = GetType().FullName + baseType;
}
return typeId;
}
}
public override bool Equals(object obj) {
if (obj == this) {
return true;
}
DesignerAttribute other = obj as DesignerAttribute;
return (other != null) && other.designerBaseTypeName == designerBaseTypeName && other.designerTypeName == designerTypeName;
}
public override int GetHashCode() {
return designerTypeName.GetHashCode() ^ designerBaseTypeName.GetHashCode();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RowType.cs
- WizardPanel.cs
- SymmetricAlgorithm.cs
- Oci.cs
- CorrelationTokenInvalidatedHandler.cs
- WebPartEditVerb.cs
- SrgsRulesCollection.cs
- MetadataHelper.cs
- GridItemCollection.cs
- XsltArgumentList.cs
- EasingQuaternionKeyFrame.cs
- DBParameter.cs
- FormCollection.cs
- NullableLongAverageAggregationOperator.cs
- IFlowDocumentViewer.cs
- tabpagecollectioneditor.cs
- FilterQueryOptionExpression.cs
- NavigationProperty.cs
- ServiceNameCollection.cs
- QueryOptionExpression.cs
- WebPartZone.cs
- PrinterResolution.cs
- CharacterBuffer.cs
- StatusBarDrawItemEvent.cs
- DetailsViewInsertedEventArgs.cs
- ClientOptions.cs
- ParamArrayAttribute.cs
- XmlSchemaGroupRef.cs
- KeyValueConfigurationElement.cs
- OutputCacheSettingsSection.cs
- DocumentPageView.cs
- ConstNode.cs
- HttpFileCollectionBase.cs
- DataComponentNameHandler.cs
- Sequence.cs
- DbProviderFactoriesConfigurationHandler.cs
- ReferencedCollectionType.cs
- NamespaceQuery.cs
- TextElementAutomationPeer.cs
- QueryableDataSourceHelper.cs
- ConditionCollection.cs
- EmbeddedMailObjectsCollection.cs
- Int16.cs
- TypeSystem.cs
- Bidi.cs
- Propagator.JoinPropagator.cs
- ManagementObjectCollection.cs
- TextChangedEventArgs.cs
- ILGenerator.cs
- EllipseGeometry.cs
- EncoderBestFitFallback.cs
- GetCryptoTransformRequest.cs
- DataListItemCollection.cs
- AddInDeploymentState.cs
- ClientTargetSection.cs
- PageParserFilter.cs
- DatatypeImplementation.cs
- CqlBlock.cs
- QueryPageSettingsEventArgs.cs
- GradientBrush.cs
- HttpFileCollection.cs
- CodeAttributeDeclaration.cs
- FrameworkTemplate.cs
- Query.cs
- QilGenerator.cs
- PublisherMembershipCondition.cs
- HMACSHA1.cs
- SessionStateUtil.cs
- WSHttpSecurity.cs
- OracleString.cs
- HealthMonitoringSection.cs
- KeyboardNavigation.cs
- ListBoxDesigner.cs
- ImageList.cs
- ThreadStateException.cs
- UnsupportedPolicyOptionsException.cs
- AncestorChangedEventArgs.cs
- DifferencingCollection.cs
- PngBitmapDecoder.cs
- ApplicationHost.cs
- DialogResultConverter.cs
- OutputCacheModule.cs
- IsolatedStorageFilePermission.cs
- Selector.cs
- SerialErrors.cs
- ValueChangedEventManager.cs
- XmlSerializerSection.cs
- IgnoreSection.cs
- LinqMaximalSubtreeNominator.cs
- IndexingContentUnit.cs
- SerializationTrace.cs
- XmlILIndex.cs
- ImplicitInputBrush.cs
- ASCIIEncoding.cs
- MethodCallTranslator.cs
- UIPropertyMetadata.cs
- TransactionScope.cs
- TemplateNameScope.cs
- CqlLexerHelpers.cs
- Validator.cs