LicenseManager.IsValid 方法

定义

确定是否可以授予有效的许可证。

重载

IsValid(Type)

确定是否可以为指定类型授予有效的许可证。

IsValid(Type, Object, License)

确定是否可以为该类型的指定实例授予有效的许可证。 该方法创建有效的 License

IsValid(Type)

Source:
LicenseManager.cs
Source:
LicenseManager.cs
Source:
LicenseManager.cs

确定是否可以为指定类型授予有效的许可证。

public static bool IsValid (Type type);

参数

type
Type

一个 Type,表示请求 License 的对象的类型。

返回

如果可以授予有效许可证,则为 true;否则为 false

注解

IsValid 类型未获得许可或已获得许可且许可证有效时,方法将返回 true

当无法授予有效的 License时,此方法不会引发 LicenseException 。 方法 Validate 引发异常。

另请参阅

适用于

.NET 9 和其他版本
产品 版本
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

IsValid(Type, Object, License)

Source:
LicenseManager.cs
Source:
LicenseManager.cs
Source:
LicenseManager.cs

确定是否可以为该类型的指定实例授予有效的许可证。 该方法创建有效的 License

public static bool IsValid (Type type, object instance, out System.ComponentModel.License license);
public static bool IsValid (Type type, object? instance, out System.ComponentModel.License? license);

参数

type
Type

一个 Type,表示请求许可证的对象的类型。

instance
Object

指定类型的对象或从指定类型派生的类型的对象。

license
License

一个作为有效许可证的 License;如果无法颁发有效许可证,则为 null

返回

如果可以颁发有效的 License,则为 true;否则为 false

注解

IsValidtype参数未获得许可或已获得许可且参数有效时,license方法将返回 true

当无法授予有效的 License时,此方法不会引发 LicenseException 。 方法 Validate 引发异常。

license如果 参数不是null在此调用之后,则请求 的对象License必须在释放或最终确定对象时通过调用 Dispose 方法来释放许可证。

另请参阅

适用于

.NET 9 和其他版本
产品 版本
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1