Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / LicenseProviderAttribute.cs / 1 / LicenseProviderAttribute.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel {
using System;
using System.Security.Permissions;
///
/// Specifies the
/// to use with a class.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class LicenseProviderAttribute : Attribute {
///
///
/// Specifies the default value, which is no provider. This field is read-only.
///
///
public static readonly LicenseProviderAttribute Default = new LicenseProviderAttribute();
private Type licenseProviderType = null;
private string licenseProviderName = null;
///
/// Initializes a new instance of the class without a license
/// provider.
///
public LicenseProviderAttribute() : this((string)null) {
}
///
///
/// Initializes a new instance of the class with
/// the specified type.
///
///
public LicenseProviderAttribute(string typeName) {
licenseProviderName = typeName;
}
///
///
/// Initializes a new instance of the class with
/// the specified type of license provider.
///
///
public LicenseProviderAttribute(Type type) {
licenseProviderType = type;
}
///
/// Gets the license provider to use with the associated class.
///
public Type LicenseProvider {
// SECREVIEW: Remove this attribute once bug#411910 is fixed.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2113:SecureLateBindingMethods")]
get {
if (licenseProviderType == null && licenseProviderName != null) {
licenseProviderType = Type.GetType(licenseProviderName);
}
return licenseProviderType;
}
}
///
///
///
/// 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. LicenseProviderAttribute overrides this to include the type name and the
/// provider type name.
///
///
public override object TypeId {
get {
string typeName = licenseProviderName;
if (typeName == null && licenseProviderType != null) {
typeName = licenseProviderType.FullName;
}
return GetType().FullName + typeName;
}
}
///
///
///
public override bool Equals(object value) {
if (value is LicenseProviderAttribute && value != null) {
Type type = ((LicenseProviderAttribute)value).LicenseProvider;
if (type == LicenseProvider) {
return true;
}
else {
if (type != null && type.Equals(LicenseProvider)) {
return true;
}
}
}
return false;
}
///
///
/// Returns the hashcode for this object.
///
///
public override int GetHashCode() {
return base.GetHashCode();
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AutoCompleteStringCollection.cs
- DataRowExtensions.cs
- UIElement3D.cs
- LoadedOrUnloadedOperation.cs
- UserNamePasswordClientCredential.cs
- DoubleLink.cs
- XmlCDATASection.cs
- ApplicationFileParser.cs
- TraceInternal.cs
- MessageBox.cs
- CopyCodeAction.cs
- ProcessStartInfo.cs
- Point3DIndependentAnimationStorage.cs
- storepermissionattribute.cs
- NativeMethods.cs
- MetadataCollection.cs
- XmlNodeChangedEventArgs.cs
- RealProxy.cs
- WriteTimeStream.cs
- UInt16Converter.cs
- SpotLight.cs
- AppDomainUnloadedException.cs
- FileAuthorizationModule.cs
- AmbientProperties.cs
- PackWebRequest.cs
- ParameterToken.cs
- NavigationEventArgs.cs
- XmlQueryType.cs
- HttpBufferlessInputStream.cs
- TreeNodeBinding.cs
- XsltFunctions.cs
- DLinqTableProvider.cs
- EventMappingSettingsCollection.cs
- EventItfInfo.cs
- _RequestCacheProtocol.cs
- PrintDocument.cs
- BmpBitmapEncoder.cs
- XmlImplementation.cs
- TableLayoutSettings.cs
- ClientApiGenerator.cs
- VirtualizingPanel.cs
- WindowsBrush.cs
- CodeGenerator.cs
- EndEvent.cs
- GACMembershipCondition.cs
- InheritanceAttribute.cs
- SizeKeyFrameCollection.cs
- SubqueryRules.cs
- BinaryObjectReader.cs
- KeyTime.cs
- InplaceBitmapMetadataWriter.cs
- ThicknessAnimation.cs
- ResXResourceReader.cs
- StreamInfo.cs
- PassportPrincipal.cs
- LogExtentCollection.cs
- GridViewRowPresenter.cs
- ArrayHelper.cs
- StateRuntime.cs
- XmlDataDocument.cs
- JumpTask.cs
- CodeMethodInvokeExpression.cs
- GeometryDrawing.cs
- errorpatternmatcher.cs
- CodeGenerator.cs
- WebPartEditorCancelVerb.cs
- SiteOfOriginContainer.cs
- HijriCalendar.cs
- LongAverageAggregationOperator.cs
- Nullable.cs
- RichTextBoxAutomationPeer.cs
- HandledMouseEvent.cs
- NonVisualControlAttribute.cs
- EdmValidator.cs
- ServiceChannelManager.cs
- AppSettingsReader.cs
- PointValueSerializer.cs
- DesignerAutoFormat.cs
- Rotation3D.cs
- AssemblyBuilder.cs
- SmiXetterAccessMap.cs
- XmlValueConverter.cs
- EntityDataSourceWrapperCollection.cs
- _LoggingObject.cs
- EntityContainerEntitySetDefiningQuery.cs
- DesignSurfaceCollection.cs
- ItemMap.cs
- OSFeature.cs
- PrinterUnitConvert.cs
- DockPanel.cs
- DockPattern.cs
- XmlSchemaGroupRef.cs
- SQLRoleProvider.cs
- WebPartManager.cs
- SlotInfo.cs
- PointHitTestParameters.cs
- WorkflowQueueInfo.cs
- BitmapDownload.cs
- Timer.cs
- SBCSCodePageEncoding.cs