-
Notifications
You must be signed in to change notification settings - Fork 0
NSG.Library.Helpers
NSG.Library.Helpers is a collection of support helper (static) methods. The helper methods are in four classes as follows:
- App setting configuration retrieval (Config),
- Files and file system utilities (Files),
- Operation system (OS) command execution (OS).
- System extensions.
|
The namespace contains a collection of static helper methods.
Static helpers for handling AppSettings configuration.
AppSetting key value
if not found return this value Get a value from the AppSetting section of the web config.
string of the value in the appSetting section in the config file.
AppSetting key value
if not found return this boolean value Get a value from the AppSetting section of the web config.
boolean value in the appSetting section in the config file.
AppSetting key value
if not found return this integer value Get a value from the AppSetting section of the web config.
integer value in the appSetting section in the config file.
Static helpers for handling files.
first part of file name For example: file 'prefix' examples:
- tmp
- ni (as in app initials)
- nsg (as in company initials)
the temporary file name extension: For example: file 'extent' examples:
- txt
- tmp
- log
string of prefix followed by GUID and extent
full path and file name Delete the file
name of the new direcory Make a directory
full path and file name Read a file into a in-memory byte array.
byte array Remarks: The opposite of ByteArrayToFile
byte array
full path and file name Write a file from an in-memory byte array. Remarks: The opposite of FileToByteArray
file name with out path Remove the following reserved characters and replace with a space.
- (less than)
- > (greater than)
- : (colon)
- " (double quote)
- / (forward slash)
- \ (backslash)
- | (vertical bar or pipe)
- ? (question mark)
- * (asterisk)
- , (comma)
- (amperstand)
A clean file name
Static helpers for handling Operating System interaction.
The command string to execute in the operating system.
The base directory to start the OS command. Execute the operating system command.
String of the output of the command.
Static helpers extension methods, namespaced to system, so it extends system class if included.
an enum value Get simple name of the enum value
string of literal name of the enum
an enum value Convert the enum description to the literal name of the enum. [System.ComponentModel.Description("Warehouse]Shipping
string of literal description of the enum
an enum type
an enum type Get an enumeration of the enum type
IEnumerable of T
an enum type Dictionary of all values and descriptions
Dictionary of all values and descriptions