### YamlMime:ManagedReference
items:
- uid: CapyKit.Helpers.SettingsHelper
commentId: T:CapyKit.Helpers.SettingsHelper
id: SettingsHelper
parent: CapyKit.Helpers
children:
- CapyKit.Helpers.SettingsHelper.GetApplicationSetting``1(System.String)
- CapyKit.Helpers.SettingsHelper.SetAccessorMethod(System.Func{System.String,System.Object})
- CapyKit.Helpers.SettingsHelper.SetDetectorMethod(System.Func{System.String,System.Boolean})
langs:
- csharp
- vb
name: SettingsHelper
nameWithType: SettingsHelper
fullName: CapyKit.Helpers.SettingsHelper
type: Class
source:
remote:
path: CapyKit/Helpers/SettingsHelper.cs
branch: main
repo: https://git.jordanwages.com/wagesj45/CapyKit.git
id: SettingsHelper
path: ../CapyKit/Helpers/SettingsHelper.cs
startLine: 49
assemblies:
- CapyKit
namespace: CapyKit.Helpers
summary: Static class containing helper methods for retrieving and setting application settings.
remarks: >-
The specific means of accessing and storing the settings are determined by the consumer,
allowing for flexibility in various environments such as App.config or Web.config
.
example:
- >-
This example demonstrates how to set up the SettingsHelper class with custom accessor and
detector methods that read from an App.config file. The setup is done at the beginning of the
application execution, before any other usage of the helper methods.
public int main(string[] args)
{
// Set up SettingsHelper with custom accessor and detector methods
Func<string, object> accessor = (key) =>
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
return config.AppSettings.Settings[key].Value;
};
Func<string, bool> detector = (key) =>
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
return config.AppSettings.Settings.AllKeys.Contains(key);
};
SettingsHelper.SetAccessorMethod(accessor);
SettingsHelper.SetDetectorMethod(detector);
// Use the helper to retrieve and set settings
SettingsHelper.SetApplicationSetting<int>("MySettingKey", 42);
int newSetting = SettingsHelper.GetApplicationSetting<int>("MySettingKey");
Console.WriteLine("New setting: {0}", newSetting);
int mySetting = SettingsHelper.GetApplicationSetting<int>("MySettingKey");
Console.WriteLine("Retrieved setting: {0}", mySetting);
}
syntax:
content: public static class SettingsHelper
content.vb: Public Module SettingsHelper
inheritance:
- System.Object
inheritedMembers:
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object,System.Object)
- System.Object.GetHashCode
- System.Object.GetType
- System.Object.MemberwiseClone
- System.Object.ReferenceEquals(System.Object,System.Object)
- System.Object.ToString
- uid: CapyKit.Helpers.SettingsHelper.GetApplicationSetting``1(System.String)
commentId: M:CapyKit.Helpers.SettingsHelper.GetApplicationSetting``1(System.String)
id: GetApplicationSetting``1(System.String)
parent: CapyKit.Helpers.SettingsHelper
langs:
- csharp
- vb
name: GetApplicationSetting(string)
nameWithType: SettingsHelper.GetApplicationSetting(string)
fullName: CapyKit.Helpers.SettingsHelper.GetApplicationSetting(string)
type: Method
source:
remote:
path: CapyKit/Helpers/SettingsHelper.cs
branch: main
repo: https://git.jordanwages.com/wagesj45/CapyKit.git
id: GetApplicationSetting
path: ../CapyKit/Helpers/SettingsHelper.cs
startLine: 74
assemblies:
- CapyKit
namespace: CapyKit.Helpers
summary: Retrieves a setting with the given key.
example: []
syntax:
content: public static T GetApplicationSetting(string settingName)
parameters:
- id: settingName
type: System.String
description: The name of the setting to retrieve.
typeParameters:
- id: T
description: The type of the setting to be retrieved.
return:
type: '{T}'
description: The value of the setting as an uncast T.
content.vb: Public Shared Function GetApplicationSetting(Of T)(settingName As String) As T
overload: CapyKit.Helpers.SettingsHelper.GetApplicationSetting*
nameWithType.vb: SettingsHelper.GetApplicationSetting(Of T)(String)
fullName.vb: CapyKit.Helpers.SettingsHelper.GetApplicationSetting(Of T)(String)
name.vb: GetApplicationSetting(Of T)(String)
- uid: CapyKit.Helpers.SettingsHelper.SetAccessorMethod(System.Func{System.String,System.Object})
commentId: M:CapyKit.Helpers.SettingsHelper.SetAccessorMethod(System.Func{System.String,System.Object})
id: SetAccessorMethod(System.Func{System.String,System.Object})
parent: CapyKit.Helpers.SettingsHelper
langs:
- csharp
- vb
name: SetAccessorMethod(Func)
nameWithType: SettingsHelper.SetAccessorMethod(Func)
fullName: CapyKit.Helpers.SettingsHelper.SetAccessorMethod(System.Func)
type: Method
source:
remote:
path: CapyKit/Helpers/SettingsHelper.cs
branch: main
repo: https://git.jordanwages.com/wagesj45/CapyKit.git
id: SetAccessorMethod
path: ../CapyKit/Helpers/SettingsHelper.cs
startLine: 95
assemblies:
- CapyKit
namespace: CapyKit.Helpers
summary: Sets the function used to retrieve application settings.
example: []
syntax:
content: public static void SetAccessorMethod(Func accessor)
parameters:
- id: accessor
type: System.Func{System.String,System.Object}
description: The new function used to retrieve application settings.
content.vb: Public Shared Sub SetAccessorMethod(accessor As Func(Of String, Object))
overload: CapyKit.Helpers.SettingsHelper.SetAccessorMethod*
exceptions:
- type: System.ArgumentNullException
commentId: T:System.ArgumentNullException
description: Thrown when one or more required arguments are null.
nameWithType.vb: SettingsHelper.SetAccessorMethod(Func(Of String, Object))
fullName.vb: CapyKit.Helpers.SettingsHelper.SetAccessorMethod(System.Func(Of String, Object))
name.vb: SetAccessorMethod(Func(Of String, Object))
- uid: CapyKit.Helpers.SettingsHelper.SetDetectorMethod(System.Func{System.String,System.Boolean})
commentId: M:CapyKit.Helpers.SettingsHelper.SetDetectorMethod(System.Func{System.String,System.Boolean})
id: SetDetectorMethod(System.Func{System.String,System.Boolean})
parent: CapyKit.Helpers.SettingsHelper
langs:
- csharp
- vb
name: SetDetectorMethod(Func)
nameWithType: SettingsHelper.SetDetectorMethod(Func)
fullName: CapyKit.Helpers.SettingsHelper.SetDetectorMethod(System.Func)
type: Method
source:
remote:
path: CapyKit/Helpers/SettingsHelper.cs
branch: main
repo: https://git.jordanwages.com/wagesj45/CapyKit.git
id: SetDetectorMethod
path: ../CapyKit/Helpers/SettingsHelper.cs
startLine: 118
assemblies:
- CapyKit
namespace: CapyKit.Helpers
summary: Sets the function used to detect if an application setting with a given key exists.
example: []
syntax:
content: public static void SetDetectorMethod(Func detector)
parameters:
- id: detector
type: System.Func{System.String,System.Boolean}
description: The new function used to detect if an application setting exists.
content.vb: Public Shared Sub SetDetectorMethod(detector As Func(Of String, Boolean))
overload: CapyKit.Helpers.SettingsHelper.SetDetectorMethod*
exceptions:
- type: System.ArgumentNullException
commentId: T:System.ArgumentNullException
description: Thrown when one or more required arguments are null.
nameWithType.vb: SettingsHelper.SetDetectorMethod(Func(Of String, Boolean))
fullName.vb: CapyKit.Helpers.SettingsHelper.SetDetectorMethod(System.Func(Of String, Boolean))
name.vb: SetDetectorMethod(Func(Of String, Boolean))
references:
- uid: CapyKit.Helpers
commentId: N:CapyKit.Helpers
href: CapyKit.html
name: CapyKit.Helpers
nameWithType: CapyKit.Helpers
fullName: CapyKit.Helpers
spec.csharp:
- uid: CapyKit
name: CapyKit
href: CapyKit.html
- name: .
- uid: CapyKit.Helpers
name: Helpers
href: CapyKit.Helpers.html
spec.vb:
- uid: CapyKit
name: CapyKit
href: CapyKit.html
- name: .
- uid: CapyKit.Helpers
name: Helpers
href: CapyKit.Helpers.html
- uid: System.Object
commentId: T:System.Object
parent: System
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
name: object
nameWithType: object
fullName: object
nameWithType.vb: Object
fullName.vb: Object
name.vb: Object
- uid: System.Object.Equals(System.Object)
commentId: M:System.Object.Equals(System.Object)
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
name: Equals(object)
nameWithType: object.Equals(object)
fullName: object.Equals(object)
nameWithType.vb: Object.Equals(Object)
fullName.vb: Object.Equals(Object)
name.vb: Equals(Object)
spec.csharp:
- uid: System.Object.Equals(System.Object)
name: Equals
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
- name: (
- uid: System.Object
name: object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
spec.vb:
- uid: System.Object.Equals(System.Object)
name: Equals
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
- name: (
- uid: System.Object
name: Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
- uid: System.Object.Equals(System.Object,System.Object)
commentId: M:System.Object.Equals(System.Object,System.Object)
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
name: Equals(object, object)
nameWithType: object.Equals(object, object)
fullName: object.Equals(object, object)
nameWithType.vb: Object.Equals(Object, Object)
fullName.vb: Object.Equals(Object, Object)
name.vb: Equals(Object, Object)
spec.csharp:
- uid: System.Object.Equals(System.Object,System.Object)
name: Equals
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
- name: (
- uid: System.Object
name: object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: ','
- name: " "
- uid: System.Object
name: object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
spec.vb:
- uid: System.Object.Equals(System.Object,System.Object)
name: Equals
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
- name: (
- uid: System.Object
name: Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: ','
- name: " "
- uid: System.Object
name: Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
- uid: System.Object.GetHashCode
commentId: M:System.Object.GetHashCode
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
name: GetHashCode()
nameWithType: object.GetHashCode()
fullName: object.GetHashCode()
nameWithType.vb: Object.GetHashCode()
fullName.vb: Object.GetHashCode()
spec.csharp:
- uid: System.Object.GetHashCode
name: GetHashCode
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- name: (
- name: )
spec.vb:
- uid: System.Object.GetHashCode
name: GetHashCode
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- name: (
- name: )
- uid: System.Object.GetType
commentId: M:System.Object.GetType
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.gettype
name: GetType()
nameWithType: object.GetType()
fullName: object.GetType()
nameWithType.vb: Object.GetType()
fullName.vb: Object.GetType()
spec.csharp:
- uid: System.Object.GetType
name: GetType
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.gettype
- name: (
- name: )
spec.vb:
- uid: System.Object.GetType
name: GetType
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.gettype
- name: (
- name: )
- uid: System.Object.MemberwiseClone
commentId: M:System.Object.MemberwiseClone
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone
name: MemberwiseClone()
nameWithType: object.MemberwiseClone()
fullName: object.MemberwiseClone()
nameWithType.vb: Object.MemberwiseClone()
fullName.vb: Object.MemberwiseClone()
spec.csharp:
- uid: System.Object.MemberwiseClone
name: MemberwiseClone
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone
- name: (
- name: )
spec.vb:
- uid: System.Object.MemberwiseClone
name: MemberwiseClone
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone
- name: (
- name: )
- uid: System.Object.ReferenceEquals(System.Object,System.Object)
commentId: M:System.Object.ReferenceEquals(System.Object,System.Object)
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
name: ReferenceEquals(object, object)
nameWithType: object.ReferenceEquals(object, object)
fullName: object.ReferenceEquals(object, object)
nameWithType.vb: Object.ReferenceEquals(Object, Object)
fullName.vb: Object.ReferenceEquals(Object, Object)
name.vb: ReferenceEquals(Object, Object)
spec.csharp:
- uid: System.Object.ReferenceEquals(System.Object,System.Object)
name: ReferenceEquals
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- name: (
- uid: System.Object
name: object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: ','
- name: " "
- uid: System.Object
name: object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
spec.vb:
- uid: System.Object.ReferenceEquals(System.Object,System.Object)
name: ReferenceEquals
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- name: (
- uid: System.Object
name: Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: ','
- name: " "
- uid: System.Object
name: Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
- uid: System.Object.ToString
commentId: M:System.Object.ToString
parent: System.Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.tostring
name: ToString()
nameWithType: object.ToString()
fullName: object.ToString()
nameWithType.vb: Object.ToString()
fullName.vb: Object.ToString()
spec.csharp:
- uid: System.Object.ToString
name: ToString
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.tostring
- name: (
- name: )
spec.vb:
- uid: System.Object.ToString
name: ToString
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object.tostring
- name: (
- name: )
- uid: System
commentId: N:System
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system
name: System
nameWithType: System
fullName: System
- uid: CapyKit.Helpers.SettingsHelper.GetApplicationSetting*
commentId: Overload:CapyKit.Helpers.SettingsHelper.GetApplicationSetting
href: CapyKit.Helpers.SettingsHelper.html#CapyKit_Helpers_SettingsHelper_GetApplicationSetting__1_System_String_
name: GetApplicationSetting
nameWithType: SettingsHelper.GetApplicationSetting
fullName: CapyKit.Helpers.SettingsHelper.GetApplicationSetting
- uid: System.String
commentId: T:System.String
parent: System
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.string
name: string
nameWithType: string
fullName: string
nameWithType.vb: String
fullName.vb: String
name.vb: String
- uid: '{T}'
commentId: '!:T'
definition: T
name: T
nameWithType: T
fullName: T
- uid: T
name: T
nameWithType: T
fullName: T
- uid: System.ArgumentNullException
commentId: T:System.ArgumentNullException
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
name: ArgumentNullException
nameWithType: ArgumentNullException
fullName: System.ArgumentNullException
- uid: CapyKit.Helpers.SettingsHelper.SetAccessorMethod*
commentId: Overload:CapyKit.Helpers.SettingsHelper.SetAccessorMethod
href: CapyKit.Helpers.SettingsHelper.html#CapyKit_Helpers_SettingsHelper_SetAccessorMethod_System_Func_System_String_System_Object__
name: SetAccessorMethod
nameWithType: SettingsHelper.SetAccessorMethod
fullName: CapyKit.Helpers.SettingsHelper.SetAccessorMethod
- uid: System.Func{System.String,System.Object}
commentId: T:System.Func{System.String,System.Object}
parent: System
definition: System.Func`2
href: https://learn.microsoft.com/dotnet/api/system.func-2
name: Func
nameWithType: Func
fullName: System.Func
nameWithType.vb: Func(Of String, Object)
fullName.vb: System.Func(Of String, Object)
name.vb: Func(Of String, Object)
spec.csharp:
- uid: System.Func`2
name: Func
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
- name: <
- uid: System.String
name: string
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.string
- name: ','
- name: " "
- uid: System.Object
name: object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: '>'
spec.vb:
- uid: System.Func`2
name: Func
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
- name: (
- name: Of
- name: " "
- uid: System.String
name: String
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.string
- name: ','
- name: " "
- uid: System.Object
name: Object
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.object
- name: )
- uid: System.Func`2
commentId: T:System.Func`2
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
name: Func
nameWithType: Func
fullName: System.Func
nameWithType.vb: Func(Of T, TResult)
fullName.vb: System.Func(Of T, TResult)
name.vb: Func(Of T, TResult)
spec.csharp:
- uid: System.Func`2
name: Func
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
- name: <
- name: T
- name: ','
- name: " "
- name: TResult
- name: '>'
spec.vb:
- uid: System.Func`2
name: Func
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
- name: (
- name: Of
- name: " "
- name: T
- name: ','
- name: " "
- name: TResult
- name: )
- uid: CapyKit.Helpers.SettingsHelper.SetDetectorMethod*
commentId: Overload:CapyKit.Helpers.SettingsHelper.SetDetectorMethod
href: CapyKit.Helpers.SettingsHelper.html#CapyKit_Helpers_SettingsHelper_SetDetectorMethod_System_Func_System_String_System_Boolean__
name: SetDetectorMethod
nameWithType: SettingsHelper.SetDetectorMethod
fullName: CapyKit.Helpers.SettingsHelper.SetDetectorMethod
- uid: System.Func{System.String,System.Boolean}
commentId: T:System.Func{System.String,System.Boolean}
parent: System
definition: System.Func`2
href: https://learn.microsoft.com/dotnet/api/system.func-2
name: Func
nameWithType: Func
fullName: System.Func
nameWithType.vb: Func(Of String, Boolean)
fullName.vb: System.Func(Of String, Boolean)
name.vb: Func(Of String, Boolean)
spec.csharp:
- uid: System.Func`2
name: Func
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
- name: <
- uid: System.String
name: string
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.string
- name: ','
- name: " "
- uid: System.Boolean
name: bool
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.boolean
- name: '>'
spec.vb:
- uid: System.Func`2
name: Func
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.func-2
- name: (
- name: Of
- name: " "
- uid: System.String
name: String
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.string
- name: ','
- name: " "
- uid: System.Boolean
name: Boolean
isExternal: true
href: https://learn.microsoft.com/dotnet/api/system.boolean
- name: )