Click or drag to resize

IConfigContains Method

Indicates if the specified item is contains in the configuration of the specified module.

Namespace:  AskiaPortalCmn.Configuration
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
bool Contains(
	string key,
	Nullable<Guid> moduleGuid = null
)

Parameters

key
Type: SystemString
Key of the config to test
moduleGuid (Optional)
Type: SystemNullableGuid
GUID of the module from where the config belongs to.
If null or omit, the CurrentModule will be used.

Return Value

Type: Boolean
Returns True when the specified item is contains in the configuration
Examples

Indicates if the config item of `myModule` with the key `key1` is define.

using AskiaPortalCmn.Configuration;

// ...
var config = Config.GetInstance();
var myModuleGuid = Guid.Parse("0c3845fd-2465-42ca-84ba-3ab39e521098");
if (config.Contains("key1", myModuleGuid))
{
    Console.WriteLine("The item `key1` is define in the config of `myModule`");
}
else 
{
    Console.WriteLine("The item `key1` is NOT define in the config of `myModule`");
}
See Also