Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// 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();
}
}
}
// 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
- Processor.cs
- WaitingCursor.cs
- SqlDataSourceCache.cs
- Formatter.cs
- InvalidFilterCriteriaException.cs
- EditorBrowsableAttribute.cs
- Font.cs
- TextEndOfLine.cs
- LabelAutomationPeer.cs
- StringPropertyBuilder.cs
- Propagator.ExtentPlaceholderCreator.cs
- SamlAction.cs
- sitestring.cs
- TargetControlTypeCache.cs
- Stylesheet.cs
- TextPenaltyModule.cs
- WorkflowServiceHost.cs
- XsltContext.cs
- AnnotationResourceChangedEventArgs.cs
- WorkItem.cs
- ThicknessKeyFrameCollection.cs
- ConfigPathUtility.cs
- RunInstallerAttribute.cs
- SQLInt16.cs
- CanonicalizationDriver.cs
- IntMinMaxAggregationOperator.cs
- MarshalDirectiveException.cs
- XmlDataImplementation.cs
- TransformerTypeCollection.cs
- ConnectionsZoneDesigner.cs
- BaseParagraph.cs
- FlowNode.cs
- SpotLight.cs
- XamlBrushSerializer.cs
- QueryAsyncResult.cs
- InputDevice.cs
- SystemIPInterfaceStatistics.cs
- ValueUnavailableException.cs
- EncodingDataItem.cs
- PlatformCulture.cs
- TreeIterator.cs
- UserControlParser.cs
- TransportElement.cs
- FigureParagraph.cs
- InkCanvasSelectionAdorner.cs
- NCryptNative.cs
- XsltContext.cs
- Block.cs
- _Win32.cs
- RawStylusSystemGestureInputReport.cs
- RegisteredHiddenField.cs
- RegexBoyerMoore.cs
- CodeSnippetStatement.cs
- TransformPattern.cs
- DecoderFallbackWithFailureFlag.cs
- _AutoWebProxyScriptHelper.cs
- ApplicationInfo.cs
- Enlistment.cs
- PackWebRequestFactory.cs
- XmlNodeList.cs
- StretchValidation.cs
- RemoteWebConfigurationHostStream.cs
- Model3D.cs
- AsyncOperationManager.cs
- RenderData.cs
- DataTablePropertyDescriptor.cs
- HttpRequest.cs
- BaseConfigurationRecord.cs
- AudioSignalProblemOccurredEventArgs.cs
- ConvertBinder.cs
- AQNBuilder.cs
- ObjectListDataBindEventArgs.cs
- DataGridRow.cs
- WeakReferenceEnumerator.cs
- ForceCopyBuildProvider.cs
- ContainerParagraph.cs
- RIPEMD160Managed.cs
- XmlILStorageConverter.cs
- AnimationTimeline.cs
- DataTableCollection.cs
- MdiWindowListItemConverter.cs
- WinEventQueueItem.cs
- DefaultPropertiesToSend.cs
- ExpressionVisitorHelpers.cs
- EdmMember.cs
- DetailsViewInsertEventArgs.cs
- SecurityManager.cs
- InlineCollection.cs
- RemotingSurrogateSelector.cs
- WindowsAltTab.cs
- IconBitmapDecoder.cs
- WindowPattern.cs
- RijndaelManaged.cs
- DataReaderContainer.cs
- NavigationExpr.cs
- ChangeInterceptorAttribute.cs
- CharacterMetricsDictionary.cs
- ImageFormatConverter.cs
- XmlNullResolver.cs
- StringResourceManager.cs