Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / DesignerAttribute.cs / 1 / 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();
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ViewCellSlot.cs
- XmlSchemaSimpleTypeList.cs
- OneOfTypeConst.cs
- SignatureDescription.cs
- SeparatorAutomationPeer.cs
- GridViewUpdateEventArgs.cs
- ResourceExpressionBuilder.cs
- SqlDuplicator.cs
- XmlSchemaAnnotated.cs
- TypeUtil.cs
- CompiledQueryCacheKey.cs
- DataGridViewCellLinkedList.cs
- PackagingUtilities.cs
- StringConverter.cs
- BooleanStorage.cs
- BoundPropertyEntry.cs
- SqlDataSourceView.cs
- Freezable.cs
- DecimalConstantAttribute.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- WriteFileContext.cs
- RadioButton.cs
- Button.cs
- MemoryMappedView.cs
- DataTableExtensions.cs
- ClassHandlersStore.cs
- ValidationResult.cs
- peersecurityelement.cs
- ObjectListItemCollection.cs
- ADMembershipProvider.cs
- AddIn.cs
- PointAnimationClockResource.cs
- ManagedIStream.cs
- CompModSwitches.cs
- FacetValueContainer.cs
- HandleRef.cs
- ServiceHandle.cs
- DataGridBeginningEditEventArgs.cs
- StrongNameHelpers.cs
- ActiveXHost.cs
- DataSourceHelper.cs
- SyndicationElementExtension.cs
- Trustee.cs
- AttributeAction.cs
- AddInServer.cs
- ChangeInterceptorAttribute.cs
- OverflowException.cs
- SqlWriter.cs
- UInt32.cs
- AmbientValueAttribute.cs
- Transactions.cs
- ConnectionStringsSection.cs
- KnownTypes.cs
- SchemaCollectionPreprocessor.cs
- EventDescriptorCollection.cs
- ListViewCommandEventArgs.cs
- cookiecontainer.cs
- HtmlInputFile.cs
- XmlSecureResolver.cs
- Int32Collection.cs
- safemediahandle.cs
- LayoutSettings.cs
- PointAnimationUsingPath.cs
- FileLevelControlBuilderAttribute.cs
- BindingListCollectionView.cs
- XhtmlConformanceSection.cs
- SerializationObjectManager.cs
- SortQuery.cs
- XmlMapping.cs
- SiteOfOriginContainer.cs
- OleDbErrorCollection.cs
- CompiledQuery.cs
- QilXmlReader.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- XmlSchemaAll.cs
- TraceListeners.cs
- AuthenticationSchemesHelper.cs
- ChannelTokenTypeConverter.cs
- TextRangeEdit.cs
- ColorTransformHelper.cs
- QueryStatement.cs
- RightsManagementInformation.cs
- Menu.cs
- DbProviderFactoriesConfigurationHandler.cs
- StringStorage.cs
- AccessControlList.cs
- DataGridLinkButton.cs
- HttpHandlersSection.cs
- EventWaitHandle.cs
- ConfigurationLockCollection.cs
- SqlFacetAttribute.cs
- AddDataControlFieldDialog.cs
- SchemaTableColumn.cs
- ReadOnlyDictionary.cs
- WindowsFont.cs
- CssClassPropertyAttribute.cs
- InputProcessorProfilesLoader.cs
- DrawItemEvent.cs
- PhysicalAddress.cs
- CustomWebEventKey.cs