Standard Library¶
string¶
Description¶
Represents a sequence of alphanumeric characters and exposes functionality to act upon and with it
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Length | int | No | No | Gets the number of alphanumeric characters in the string |
Methods¶
StartsWith(string)¶
Description
Returns whether the string starts with another string
Return Type : bool
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The text to find in the beginning of the original string |
Syntax
string content = "<p>Greetings and welcome to <b>Hogwarts</b>!!!</p>";
bool isParagraph = content.StartsWith("<p>");
HasValue()¶
Description
Determines whether the string has a value. False means that the string is NULL
Return Type : bool
Static : No
Namespace : StandardLibrary.string
Syntax
function void Login(string username, string password)
{
if(!username.HasValue() || !password.HasValue()){
ShowMessage("At least one of your provided values is NULL!");
}
}
EndsWith(string)¶
Description
Returns whether the string ends with another string
Return Type : bool
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The text to find in the end of the original string |
Syntax
string text = "How do you like Hogwarts so far?";
bool isQuestion = text.EndsWith("?");
Format(string, Object)¶
Description
Replaces a format item in the original formatted-string with a stringified object
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The object to be formatted |
Syntax
string text = "You will be placed in ... {0}!";
string arg0 = "Gryffindor";
ShowMessage(string.Format(text, arg0)); //Shows "You will be placed in ... Gryffindor!"
Format(string, Object, Object)¶
Description
Replaces two format items in the original formatted-string with their relative stringified objects
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The first object to be formatted |
arg1 | Object | The second object to be formatted |
Syntax
string text = "You will be placed in {0}, unless you'd prefer {1}";
string arg0 = "Gryffindor";
string arg1 = "Slytherin";
ShowMessage(string.Format(text, arg0, arg1)); //Shows "You will be placed in Gryffindor, unless you'd prefer Slytherin"
Format(string, Object, Object, Object)¶
Description
Replaces three format items in the original formatted-string with their relative stringified objects
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The first object to be formatted |
arg1 | Object | The second object to be formatted |
arg2 | Object | The third object to be formatted |
Syntax
string text = "{0} was founded by {1}. The head of the House is {2}";
string arg0 = "Gryffindor";
string arg1 = "Godric Gryffindor";
string arg2 = "Minerva McGonagall ";
ShowMessage(string.Format(text, arg0, arg1, arg2)); //Shows "Gryffindor was founded by Godric Gryffindor. The head of the House is Minerva McGonagall"
Format(string, Object, Object, Object, Object)¶
Description
Replaces four format items in the original formatted-string with their relative stringified objects
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The first object to be formatted |
arg1 | Object | The second object to be formatted |
arg2 | Object | The third object to be formatted |
arg3 | Object | The fourth object to be formatted |
Syntax
string text = "{0} was founded by {1} in the {3} century. The head of the House is {2}";
string arg0 = "Gryffindor";
string arg1 = "Godric Gryffindor";
string arg2 = "Minerva McGonagall ";
string arg3 = "10th";
ShowMessage(string.Format(text, arg0, arg1, arg2, arg3)); //Shows "Gryffindor was founded by Godric Gryffindor in the 10th century. The head of the House is Minerva McGonagall"
Format(string, Object, Object, Object, Object, Object)¶
Description
Replaces five format items in the original formatted-string with their relative stringified objects
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The first object to be formatted |
arg1 | Object | The second object to be formatted |
arg2 | Object | The third object to be formatted |
arg3 | Object | The fourth object to be formatted |
arg4 | Object | The fifth object to be formatted |
Syntax
string quote = "'It does {0} do to {1} on {2} and {3} to {4}.' �Dumbledore";
string arg0 = "not";
string arg1 = "dwell";
string arg2 = "dreams";
string arg3 = "forget";
string arg4 = "live";
ShowMessage(string.Format(quote, arg0, arg1, arg2, arg3, arg4)); //Shows "'It does not do to dwell on dreams and forget to live.' �Dumbledore"
Format(string, Object, Object, Object, Object, Object, Object)¶
Description
Replaces six format items in the original formatted-string with their relative stringified objects
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The first object to be formatted |
arg1 | Object | The second object to be formatted |
arg2 | Object | The third object to be formatted |
arg3 | Object | The fourth object to be formatted |
arg4 | Object | The fifth object to be formatted |
arg5 | Object | The sixth object to be formatted |
Syntax
string quote = "'It does {0} do to {1} on {2} and {3} to {4}.' �{5}";
string arg0 = "not";
string arg1 = "dwell";
string arg2 = "dreams";
string arg3 = "forget";
string arg4 = "live";
string arg5 = "Dumbledore";
ShowMessage(string.Format(quote, arg0, arg1, arg2, arg3, arg4, arg5)); //Shows "'It does not do to dwell on dreams and forget to live.' �Dumbledore"
Format(string, Object, Object, Object, Object, Object, Object, Object)¶
Description
Replaces seven format items in the original formatted-string with their relative stringified objects
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The format string |
arg0 | Object | The first object to be formatted |
arg1 | Object | The second object to be formatted |
arg2 | Object | The third object to be formatted |
arg3 | Object | The fourth object to be formatted |
arg4 | Object | The fifth object to be formatted |
arg5 | Object | The sixth object to be formatted |
arg6 | Object | The seventh object to be formatted |
Syntax
string quote = "'It does {0} do to {1} on {2} and {3} to {4}.' �{5} {6}";
string arg0 = "not";
string arg1 = "dwell";
string arg2 = "dreams";
string arg3 = "forget";
string arg4 = "live";
string arg5 = "Albus";
string arg6 = "Dumbledore"
ShowMessage(string.Format(quote, arg0, arg1, arg2, arg3, arg4, arg5, arg6)); //Shows "'It does not do to dwell on dreams and forget to live.' �Albus Dumbledore"
Trim()¶
Description
Removes the empty characters from the beginning and the end of a string
Return Type : string
Static : No
Namespace : StandardLibrary.string
Syntax
string quote = " I solemnly swear that I am up to no good ";
string trimmedQuote = quote.Trim();
ShowMessage(trimmedQuote); //Will show 'I solemnly swear that I am up to no good'
GetEmpty()¶
Description
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Syntax
//Initialize the text with an empty string
string text = string.GetEmpty(); //text is ""
//And now add values
text = text + "And now I have values!"; //text is "And now I have values"
IsNullOrEmpty(string)¶
Description
Returns whether the string is null or empty
Return Type : bool
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
stringToCheck | string | The string to check |
Syntax
function void Validate(string email)
{
if(string.IsNullOrEmpty(email)){
throw BusinessException.Create("The e-mail you provided is either null or an empty string");
}
}
Singularize(string)¶
Description
Converts a word to its singular form
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
word | string | The word to convert |
Syntax
string a = "children";
string b = "stars";
ShowMessage(string.Format("The {0} made a wish upon the {1}", string.Singularize(a), string.Singularize(b)));
//Will show: The child made a wish upon the star
Pluralize(string)¶
Description
Converts a word to its plural form
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
word | string | The word to convert |
Syntax
string a = "child";
string b = "star";
ShowMessage(string.Format("The {0} made a wish upon the {1}", string.Pluralize(a), string.Pluralize(b)));
//Will show: The children made a wish upon the stars
IsSingular(string)¶
Description
Determines whether the given word is in its singular form or not
Return Type : bool
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
word | string | The word to check |
Syntax
string a = "children";
bool isSingular = string.IsSingular(a); //here, isSingular is FALSE
a = "child"
bool isSingular = string.IsSingular(a); //here, isSingular is TRUE
IsPlural(string)¶
Description
Determines whether the given word is in its plural form or not
Return Type : bool
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
word | string | The word to check |
Syntax
string a = "children";
bool isPlural = string.IsPlural(a); //here, isPlural is TRUE
a = "child"
bool isPlural = string.IsPlural(a); //here, isPlural is FALSE
SplitCamelCase(string)¶
Description
Splits a text written in Camel Case, adding a whitespace between each occurence
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The string to be splitted |
Syntax
string inCamel = "HarryPotter";
string split = string.SplitCamelCase(inCamel);
ShowMessage(split); // will show "Harry Potter"
SplitCamelCase(string, string)¶
Description
Splits a text written in Camel Case, adding a specified separator between each occurence
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
separator | string | The separator to use between occurences |
text | string | The string to be splitted |
Syntax
string inCamel = "HarryPotter";
string split = string.SplitCamelCase("_", inCamel);
ShowMessage(split); // will show "Harry_Potter"
IsNullOrWhiteSpace(string)¶
Description
Returns whether the string is null or whitespace
Return Type : bool
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
text | string | The string to check |
Syntax
var checkA = string.IsNullOrWhiteSpace(""); // true
var checkB = string.IsNullOrWhiteSpace(" "); // true
var checkC = string.IsNullOrWhiteSpace(null); // true
var checkD = string.IsNullOrWhiteSpace("x"); // false
var checkE = string.IsNullOrWhiteSpace(" xx "); // false
TrimEnd()¶
Description
Removes the trailing spaces from the end of a string
Return Type : string
Static : No
Namespace : StandardLibrary.string
Syntax
ShowMessage(' Greetings and welcome! '); // will show ' Greetings and welcome!'
TrimStart()¶
Description
Removes the trailing spaces from the beginning of a string
Return Type : string
Static : No
Namespace : StandardLibrary.string
Syntax
ShowMessage(' Greetings and welcome! '); // will show 'Greetings and welcome! '
CharAt(int)¶
Description
Returns the Character that is positioned at the requested index of the string
Return Type : char
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
index | int | The index (position) of the character to get. The first character is at 0 |
Syntax
var spell = "Alohomora";
char m = spell.CharAt(5);
ShowMessage(m.ToString());
//Shows 'm', placed at the 5th index of the string (remember, indexes start at 0)
Substring(int)¶
Description
Gets a substring from an initial string, starting from the specified index and continuing till its end
Return Type : string
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
startIndex | int | The index of the initial string, from which the Substring will start |
Syntax
var wizard = "Harry Potter";
var surnameIndex = 6; //Here is the 'P'
var surname = wizard.Substring(6); //surname = 'Potter'
Replace(string, string)¶
Description
Returns the specified string in which all occurences of a substring (what) are replaced with a different value (with)
Return Type : string
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
what | string | The substring to be replaced |
with | string | The value to be put in the string instead of the found substring |
Syntax
var wizard = "Harry Potter";
var father = wizard.Replace("Harry", "James"); //father = James Potter
ReplaceFirst(string, string)¶
Description
Returns the specified string in which, of all occurences of a substring (what) found, only the first is replaced with the given value (with)
Return Type : string
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
what | string | The substring to be replaced |
with | string | The value to be put in the string instead of the first found substring |
Syntax
var duplicateWizards = "Harry Potter and Harry Potter";
var correctWizards = wizard.ReplaceFirst("Harry", "James"); //becomes 'James Potter and Harry Potter'
Replace(char, char)¶
Description
Returns the specified string in which all occurences of a single character (what) are replaced with a different character (with)
Return Type : string
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
what | char | The character to be replaced |
with | char | The value to be put in the string instead of the found character |
Syntax
string quote = "There are all kinds of courage, said Dumbledore, smiling. It takes a great deal of bravery to stand up to our enemies, but just as much to stand up to our friends.";
string shout = quote.Replace(".", "!");
//Result: "There are all kinds of courage, said Dumbledore, smiling! It takes a great deal of bravery to stand up to our enemies, but just as much to stand up to our friends!"
ReplaceWithRegex(string, string)¶
Description
Find matching patterns, based on a given Regular Expression, in the string and replaces them with the required text
Return Type : string
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
regex | string | The pattern to be matched |
replacement | string | The value to be overwritten instead of the matching occurences |
Syntax
string buildMessage = "Your solution has been built and has 0 warnings and 0 errors.";
string regex = "(0)+";
ShowMessage(buildMessage.ReplaceWithRegex(regex, "zero"));
//Will show: Your solution has been build and has zero warnings and zero errors.
FillWith(char, int)¶
Description
Returns a new string filled with the specified character, repeated for requested times
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
character | char | The character to repeat in the final string |
count | int | How many times to repeat the character |
Syntax
ShowMessage(string.FillWith('0', 15)); //will show 000000000000000
ToUpper()¶
Description
Converts all characters of a given string to their uppercase representation
Return Type : string
Static : No
Namespace : StandardLibrary.string
Syntax
string str = "Hello there!";
ShowMessage(str.ToUpper()); //HELLO THERE!
ToLower()¶
Description
Converts all characters of a given string to their lowercase representation
Return Type : string
Static : No
Namespace : StandardLibrary.string
Syntax
string str = "Hello There!";
ShowMessage(str.ToUpper()); //hello there!
ToTitleCase()¶
Description
Converts the first character of each word into its uppercase representation
Return Type : string
Static : No
Namespace : StandardLibrary.string
Syntax
string str = "hello there!";
ShowMessage(str.ToTitleCase()); //Hello There!
Compare(string, string)¶
Description
Compares two strings and returns a comparison result of their position in the sort order. 0 denotes equality. Important: the comparison ignores the case of the strings, so that a < A
Return Type : int
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
strA | string | The first string |
strB | string | The second string |
Syntax
var strA = "abc";
var strB = "bcd";
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB)); //Will log: -1
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA)); //Will log: 1
strA = "abc";
strB = "ABC";
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB)); //Will log: -1
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA)); //Will log: 1
strA = "abc";
strB = "abc";
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB)); //Will log: 0
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA)); //Will log: 0
Compare(string, string, bool)¶
Description
Compares two strings and returns a comparison result of their position in the sort order. 0 denotes equality. Important: if set, the comparison can ignore the case of the string, so that a = A.
Return Type : int
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
strA | string | The first string |
strB | string | The second string |
ignoreCase | bool | Indicator showing whether the case should be ignored (true) or not (false). When true, a = A. When false, a < A |
Syntax
var strA = "abc";
var strB = "bcd";
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB)); //Will log: -1
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA)); //Will log: 1
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB, true)); //Will log: -1
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA, true)); //Will log: 1
strA = "abc";
strB = "ABC";
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB)); //Will log: -1
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA)); //Will log: 1
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB, true)); //Will log: 0
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA, true)); //Will log: 0
strA = "abc";
strB = "abc";
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB)); //Will log: 0
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA)); //Will log: 0
DebugLib.Logger.WriteInfoLine(string.Compare(strA, strB, true)); //Will log: 0
DebugLib.Logger.WriteInfoLine(string.Compare(strB, strA, true)); //Will log: 0
Substring(int, int)¶
Description
Gets a substring from an initial string, starting from the specified index and continuing till it reaches the specified length in characters
Return Type : string
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
startIndex | int | The index of the initial string, from which the Substring will start |
length | int | The number of characters to include |
Syntax
var wizard = "Harry Potter";
var index = 3;
var length = 5;
var result = wizard.Substring(3, 5); //result = 'ry Po'
Contains(string)¶
Description
Checks whether a specified string exists in a given text, in a case-sensitive way
Return Type : bool
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
match | string | The string to be looked for |
Syntax
var quote = "Lorem ipsum dolor sit amet";
DebugLib.Logger.WriteInfoLine(quote.Contains("amet")); //Logs: True
DebugLib.Logger.WriteInfoLine(quote.Contains("queen")); //Logs: False
DebugLib.Logger.WriteInfoLine(quote.Contains("AMET")); //Logs: False, since the search is case-sensitive
Contains(string, bool)¶
Description
Checks whether a specified string exists in a given text, in a case-insensitive way
Return Type : bool
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
match | string | The string to be looked for |
ignoreCase | bool | If true, the search will be case-insensitive. Otherwise, the search will consider case |
Syntax
var quote = "Lorem ipsum dolor sit amet";
DebugLib.Logger.WriteInfoLine(quote.Contains("amet", true)); //Logs: True
DebugLib.Logger.WriteInfoLine(quote.Contains("queen", true)); //Logs: False
DebugLib.Logger.WriteInfoLine(quote.Contains("AMET", false)); //Logs: False, since the search is case-sensitive
DebugLib.Logger.WriteInfoLine(quote.Contains("AMET", true)); //Logs: True, since the search ignores case
IndexOf(string)¶
Description
Returns the index of the first occurence of a specified string inside a given text
Return Type : int
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
match | string | The string to find |
Syntax
var quote = "Lorem ipsum dolor sit amet";
DebugLib.Logger.WriteInfoLine(quote.IndexOf("i")); //First "i" is at index 6
LastIndexOf(string)¶
Description
Returns the index of the last occurence of a specified string inside a given text
Return Type : int
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
match | string | The string to find |
Syntax
var quote = "Lorem ipsum dolor sit amet";
DebugLib.Logger.WriteInfoLine(quote.LastIndexOf("i")); //Last "i" is at index 19
Split(char)¶
Description
Returns an array of strings, filled with the substring of the original text delimited by the specified character
Return Type : Array
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
delimiter | char | The character to use while delimiting the string into substrings |
Syntax
var quote = "Lorem_ipsum__dolor_sit_amet";
var words = quote.Split('_');
foreach string word in words {
DebugLib.Logger.WriteInfoLine(word);
}
/*
Will write:
Lorem
ipsum
dolor
sit
amet
*/
Split(Array[char], bool)¶
Description
Returns an array of non-empty strings, if 'removeEmptyEntries' is true, filled with the substring of the original text delimited by the specified characters. All substrings that have no value are removed, if required.
Return Type : Array
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
delimiter | Array | The characters to use while delimiting the string into substrings |
removeEmptyEntries | bool | If true, all empty values will be removed. |
Syntax
var quote = "Lorem[]ipsum[][][][][]dolor[]sit[]amet[]";
Array[char] delimiters = {'[', ']'};
var words = quote.Split(delimiters, true);
foreach string word in words {
DebugLib.Logger.WriteInfoLine(word);
}
/*
Will write:
Lorem
ipsum
dolor
sit
amet
*/
Split(Array[string], bool)¶
Description
Returns an array of non-empty strings, if 'removeEmptyEntries' is true, filled with the substring of the original text delimited by the specified string. All substrings that have no value are removed, if required.
Return Type : Array
Static : No
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
delimiter | Array | The string to use while delimiting the text into substrings |
removeEmptyEntries | bool | If true, all empty values will be removed. |
Syntax
Array[string] delimiter = {"GO"};
var sql =
"update Person set LockedOut = 0" +
"GO" +
"delete from Logins" +
"GO";
var commands = sql.Split(delimiter, true);
foreach string word in commands {
DebugLib.Logger.WriteInfoLine(word);
}
/*
Will write:
update Person set LockedOut = 0
delete from Logins
*/
Join(string, Array[Object])¶
Description
Connects the string values of an Array into one single string, separating its elements with the required separator
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
separator | string | The string to use as a separator |
strings | Array | Array of objects, containing the values to be joined |
Syntax
Array[string] queen = {"Freddie", "Brian", "John", "Roger" };
ShowMessage("Queen consists of: " + string.Join(", ", queen));
//Queen consists of Freddie, Brian, John, Roger
Join(string, Collection[Object])¶
Description
Connects the string values of a Collection into one single string, separating its elements with the required separator
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
separator | string | The string to use as a separator |
strings | Collection | Collection of objects, containing the values to be joined |
Syntax
Collection[string] queen;
queen.Add("Freddie");
queen.Add("Brian");
queen.Add("John");
queen.Add("Roger");
ShowMessage("Queen consists of: " + string.Join(", ", queen));
//Queen consists of Freddie, Brian, John, Roger
Concat(string, string)¶
Description
Concatenates/Joins two strings into one final string
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
str1 | string | The first string to be concatenated |
str2 | string | The second string to be concatenated |
Syntax
ShowMessage(string.Concat("a", "b")); //Shows: 'ab'
Concat(string, string, string)¶
Description
Concatenates/Joins three strings into one final string
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
str1 | string | The first string to be concatenated |
str2 | string | The second string to be concatenated |
str3 | string | The third string to be concatenated |
Syntax
ShowMessage(string.Concat("a", "b", "c")); //Shows: 'abc'
Concat(string, string, string, string)¶
Description
Concatenates/Joins four strings into one final string
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
str1 | string | The first string to be concatenated |
str2 | string | The second string to be concatenated |
str3 | string | The third string to be concatenated |
str4 | string | The fourth string to be concatenated |
Syntax
ShowMessage(string.Concat("a", "b", "c", "d")); //Shows: 'abcd'
Concat(Collection[string])¶
Description
Concatenates/Joins any number of strings, contained in a Collection, into one final string
Return Type : string
Static : Yes
Namespace : StandardLibrary.string
Parameters
Name | Data Type | Description |
---|---|---|
listOfStrings | Collection | Collection, containing the strings to be concatenated |
Syntax
Collection[string] abc;
abc.Add("a");
abc.Add("b");
abc.Add("c");
abc.Add("d");
abc.Add("e");
ShowMessage(string.Concat(abc)); //Shows 'abcde'
void¶
Description¶
Represents 'no type'. When used as a return type of a function, void denotes that the function does not return any values. When used as the value of a variable, void denotes that the variable has no value and (propably) has an unknown type
byte¶
Description¶
Represents an 8-bit, unsigned integer
Methods¶
Parse(string)¶
Description
Converts a string, representing an integral number, into its Byte equivalent
Return Type : byte
Static : Yes
Namespace : StandardLibrary.byte
Parameters
Name | Data Type | Description |
---|---|---|
string | string | The string, containing an integral number, to be converted to its Byte equivalent |
Syntax
string byteAsString = '123';
byte stringAsByte = byte.Parse(byteAsString);
DebugLib.Logger.WriteInfoLine("byteAsString: "+ byteAsString + ", stringAsByte: " + stringAsByte); //byteAsString: '123', stringAsByte: 123
ToString(string)¶
Description
Converts the value of the Byte instance to its string representation using the requested format
Return Type : string
Static : No
Namespace : StandardLibrary.byte
Parameters
Name | Data Type | Description |
---|---|---|
format | string | String, representing the numeric format to use |
Syntax
DebugLib.Logger.WriteLine("byte.Parse("230").ToString("C3") returns: " + byte.Parse("230").ToString("C3")); //$230.000
Object¶
Description¶
Represents any class in the Mamba Hierarchy, being the ultimate base class of any other class. Provides low-level functionality to derived classes
Methods¶
Equals(Object)¶
Description
Determines whether the specified object is equal to the currently instanciated object
Return Type : bool
Static : No
Namespace : StandardLibrary.Object
Parameters
Name | Data Type | Description |
---|---|---|
instance | Object | The instance of the object to be compared with the current object |
Syntax
Domain.Class class;
Domain.MyClass myClass;
class.Id = 1;
myClass.Id = 1;
//Checking too completely different classes
DebugLib.Logger.WriteInfoLine(myClass.Equals(class)); //false
DebugLib.Logger.WriteInfoLine(class.Equals(myClass)); //false
Domain.Class aClass;
Domain.Class bClass;
//Same class and same values
aClass.Id = 1;
bClass.Id = 1;
DebugLib.Logger.WriteInfoLine(aClass.Equals(bClass)); //true
//Same class, different values
bClass.Id = 100;
DebugLib.Logger.WriteInfoLine(aClass.Equals(bClass)); //false
ToString()¶
Description
Returns a string representing the current object
Return Type : string
Static : No
Namespace : StandardLibrary.Object
Syntax
Domain.ApplicationUser user;
DebugLib.Logger.WriteInfoLine(user.ToString()); //MyApplication.BO.ApplicationUser
int aNumber = 147;
DebugLib.Logger.WriteInfoLine(aNumber.ToString()); // '147'
GetType()¶
Description
Returns the type of the current object
Return Type : RuntimeType
Static : No
Namespace : StandardLibrary.Object
Syntax
Domain.ApplicationUser user;
DebugLib.Logger.WriteInfoLine(user.GetType()); //MyApplication.BO.ApplicationUser
DebugLib.Logger.WriteInfoLine(user.ToString().GetType()); //System.String
RuntimeType¶
Description¶
Represents type declarations for Domain classes, model-derived Types and other Mamba Types
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Name | string | No | No | The short name of the RuntimeType type |
FullName | string | No | No | The full name of the RuntimeType type |
IsPrimitive | bool | No | No | A flag for whether a RuntimeType instance represents a primitive type or not. |
IsCollection | bool | No | No | A flag for whether a RuntimeType instance represents a collection or not. |
Methods¶
CreateInctance(RuntimeType)¶
Description
Returns a new instance based on the RuntimeType provided.
Return Type : Object
Static : Yes
Namespace : StandardLibrary.RuntimeType
Parameters
Name | Data Type | Description |
---|---|---|
type | RuntimeType | A RuntimeType instance that is used to define the type of the new instance that will be created |
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
Domain.ApplicationUser newUser = RuntimeType.CreateInstance(userType);
GetTypeOf(Object)¶
Description
Returns a RuntimeType instance for an object instance.
Return Type : RuntimeType
Static : Yes
Namespace : StandardLibrary.RuntimeType
Parameters
Name | Data Type | Description |
---|---|---|
instance | Object | The object instance whose RuntimeType is requested. |
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType myType = RuntimeType.GetTypeOf(user);
GetProperty(string)¶
Description
Returns a RuntimeProperty instance based on a property name. If the requested Property has a getter function, it will be returned.
Return Type : RuntimeProperty
Static : No
Namespace : StandardLibrary.RuntimeType
Parameters
Name | Data Type | Description |
---|---|---|
propertyName | string | The name of the property whose RuntimeProperty instance is requested |
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
RuntimeProperty userNameProp = userType.GetProperty("UserName");
GetProperty(string, bool)¶
Description
Returns a RuntimeProperty instance based on a property name. If the requested Property has a getter function, it will be omitted if 'ignoreGetter' is true
Return Type : RuntimeProperty
Static : No
Namespace : StandardLibrary.RuntimeType
Parameters
Name | Data Type | Description |
---|---|---|
propertyName | string | The name of the property whose RuntimeProperty instance is requested |
ignoreGetter | bool | If true, creates a RuntimeProperty instance ignoring possible getter function |
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
RuntimeProperty userNameProp = userType.GetProperty("UserName", true);
GetProperties()¶
Description
Returns a collection of RuntimeProperty instances containing all properties of a RuntimeType
Return Type : Collection
Static : No
Namespace : StandardLibrary.RuntimeType
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
Collection[RuntimeProperty] allProps = userType.GetProperties();
IsSystemType()¶
Description
Checks if a RuntimeType instance represents a built-in class
Return Type : bool
Static : No
Namespace : StandardLibrary.RuntimeType
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
bool isSystem = userType.IsSystemType(); // returns true
GetGenericTypeArguments()¶
Description
Returns an array containing RuntimeType instances based on the generic arguments of a RuntimeType
Return Type : Array
Static : No
Namespace : StandardLibrary.RuntimeType
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
RuntimeType collectionType = RuntimeType.GetTypeOf(users);
RuntimeType userType = collectionType.GetGenericTypeArguments().Get(0);
ContainsGenericParameters()¶
Description
Checks if a RuntimeType defines generic parameters
Return Type : bool
Static : No
Namespace : StandardLibrary.RuntimeType
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
RuntimeType collectionType = RuntimeType.GetTypeOf(users);
bool hasGenerics = collectionType.ContainsGenericParameters(); // returns true
RuntimeProperty¶
Description¶
Returns the RuntimeType class instance of current RuntimeProperty
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Name | string | No | No | The name of the RuntimeProperty property |
IsPrimitive | bool | No | No | A flag for whether a RuntimeProperty instance represents a property of a primitive type or not. |
IsCollection | bool | No | No | A flag for whether a RuntimeProperty instance represents a collection type property. |
Methods¶
GetValue(Object)¶
Description
Returns the value of the property described in a RuntimeProperty instance, based on an �owner� instance
Return Type : Object
Static : No
Namespace : StandardLibrary.RuntimeProperty
Parameters
Name | Data Type | Description |
---|---|---|
instance | Object | The instance whose property value is requested |
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
RuntimeProperty userNameProp = userType.GetProperty("UserName");
Object value = userNameProp.GetValue(user); // returns "Admin";
SetValue(Object, Object)¶
Description
Sets new value for the property described in a RuntimeProperty instance, to an �owner� instance
Return Type : void
Static : No
Namespace : StandardLibrary.RuntimeProperty
Parameters
Name | Data Type | Description |
---|---|---|
instance | Object | The instance whose property value is being set |
value | Object | The value set to the property |
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
RuntimeProperty userNameProp = userType.GetProperty("UserName");
userNameProp.SetValue(user, "New Admin"); // now user.UserName is "New Admin"
GetRuntimeType()¶
Description
Returns a RuntimeType instance for the current object's instance.
Return Type : RuntimeType
Static : No
Namespace : StandardLibrary.RuntimeProperty
Syntax
Domain.ApplicationUser user = Domain.ApplicationUser.GetByKey("Admin");
RuntimeType userType = RuntimeType.GetTypeOf(user);
RuntimeProperty userNameProp = userType.GetProperty("UserName");
RuntimeType userNameType = userNameProp.GetRuntimeType();
string userNameTypeName = userNameType.Name; // value will be 'string'
Guid¶
Description¶
Represents a Globally Unique Identifier
Methods¶
ToString()¶
Description
Returns a string representation of the current Guid instance
Return Type : string
Static : No
Namespace : StandardLibrary.Guid
Syntax
Guid myGUID = Guid.CreateNew();//6fdd1975-2741-4523-85ba-49a1e85c38db
DebugLib.Logger.WriteInfoLine(myGUID.ToString());
CreateNew()¶
Description
Creates a new GUID instance
Return Type : Guid
Static : Yes
Namespace : StandardLibrary.Guid
Syntax
Guid myGUID = Guid.CreateNew();
DebugLib.Logger.WriteInfoLine(myGUID.ToString()); //6fdd1975-2741-4523-85ba-49a1e85c38db
GetEmpty()¶
Description
Creates a new GUID instance whos value is all zeros
Return Type : Guid
Static : Yes
Namespace : StandardLibrary.Guid
Syntax
Guid myEmptyGuid = Guid.GetEmpty();
DebugLib.Logger.WriteInfoLine(myGUID.ToString()); //00000000-0000-0000-0000-000000000000
IsNullOrEmpty(Guid)¶
Description
Checks if a GUID instance is null or its value is all zeros
Return Type : bool
Static : Yes
Namespace : StandardLibrary.Guid
Parameters
Name | Data Type | Description |
---|---|---|
guid | Guid | Guid instance to be checked |
Syntax
Guid myEmptyGuid = Guid.GetEmpty();
var isEmpty = Guid.IsNullOrEmpty(myEmptyGuid);
DebugLib.Logger.WriteInfoLine(isEmpty); //true
IsEmpty()¶
Description
Checks if a GUID instance has value all zeros
Return Type : bool
Static : No
Namespace : StandardLibrary.Guid
Syntax
Guid myEmptyGuid = Guid.GetEmpty();
var isEmpty = myEmptyGuid.IsEmpty();
DebugLib.Logger.WriteInfoLine(isEmpty); //true
Parse(string)¶
Description
Converts a string into Guid
Return Type : Guid
Static : Yes
Namespace : StandardLibrary.Guid
Parameters
Name | Data Type | Description |
---|---|---|
text | string | Text to be converted into Guid |
Syntax
Guid myGuid = Guid.Parse("6fdd1975-2741-4523-85ba-49a1e85c38db");
Parse(string, bool)¶
Description
Converts a string into Guid, with the option to not throw exception if convertion is impossible
Return Type : Guid
Static : Yes
Namespace : StandardLibrary.Guid
Parameters
Name | Data Type | Description |
---|---|---|
text | string | Text to be converted into Guid |
throwException | bool | Throw exception if convertion is impossible |
Syntax
Guid myGuid = Guid.Parse("6fdd1975-2741-4523-85ba-49a1e85c38db", false);
ToString(string)¶
Description
Returns a string representation of the current Guid instance, formatted with the provided format specifier
Return Type : string
Static : No
Namespace : StandardLibrary.Guid
Parameters
Name | Data Type | Description |
---|---|---|
format | string | Specifies the format to be used while formatting this Guid. Can be: N, B, P, X, D (D is the default) |
Syntax
Guid myGUID = Guid.CreateNew(); //6fdd1975-2741-4523-85ba-49a1e85c38db
DebugLib.Logger.WriteInfoLine(myGUID.ToString("D")); // 6fdd1975-2741-4523-85ba-49a1e85c38db
DebugLib.Logger.WriteInfoLine(myGUID.ToString("N")); // 6fdd19752741452385ba49a1e85c38db
DebugLib.Logger.WriteInfoLine(myGUID.ToString("P")); // (6fdd1975-2741-4523-85ba-49a1e85c38db)
DebugLib.Logger.WriteInfoLine(myGUID.ToString("B")); // {6fdd1975-2741-4523-85ba-49a1e85c38db}
DebugLib.Logger.WriteInfoLine(myGUID.ToString("X")); // {0x2e8b88e1,0x51fb,0x4e87,{0xb6,0xe4,0x46,0x2c,0x63,0x92,0xcd,0x15}}
int¶
Description¶
Represents a 32-bit, signed integral number
Methods¶
ToString()¶
Description
Returns the equivalent string representation of this instance's numeric value
Return Type : string
Static : No
Namespace : StandardLibrary.int
Syntax
int myInt = 147;
string myString = myInt.ToString(); //Here, myString is '147'
myInt = myInt * -1;
myString = myInt.ToString(); //myString is now '-147'
Parse(string)¶
Description
Converts a string representation of an integral number into its equivalent integer
Return Type : int
Static : Yes
Namespace : StandardLibrary.int
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string value to be converted into an integer |
Syntax
DebugLib.Logger.WriteInfoLine(int.Parse("147")); // 147
DebugLib.Logger.WriteInfoLine(int.Parse("-147")); // -147
DebugLib.Logger.WriteInfoLine(int.Parse("183,60")); //Will result in an Error
DebugLib.Logger.WriteInfoLine(int.Parse("no way")); //Will result in an Error
Parse(string, string)¶
Description
Converts a string representation of an integral number into its equivalent integer, formatted with respect to the specified locale
Return Type : int
Static : Yes
Namespace : StandardLibrary.int
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string value to be converted into an integer |
locale | string | The locale to be used while parsing the integer |
Syntax
DebugLib.Logger.WriteInfoLine(int.Parse("1470000000", "en-us"));
DebugLib.Logger.WriteInfoLine(int.Parse("1470000000", "gr"));
DebugLib.Logger.WriteInfoLine(int.Parse("1470000000", "pa"));
GetRandom(int, int)¶
Description
Returns a pseudo-random integer within a specified range
Return Type : int
Static : Yes
Namespace : StandardLibrary.int
Parameters
Name | Data Type | Description |
---|---|---|
from | int | The lower bound of the random number (inclusive) |
to | int | The upper bound of the random number (exclusive!) |
Syntax
Collection[int] randomNumbers;
//3 random numbers ranging from 0 up to 9
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(int.GetRandom(0, 10));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [0, 10]: {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [0, 10]: {9, 6, 0}
randomNumbers.Clear();
//3 random numbers ranging from -10 up to 9
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(int.GetRandom(-10, 10));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [-10, 10]: {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [-10, 10]: {1, 5, 5}
GetRandom(int, int, int)¶
Description
Returns a pseudo-random integer within a specified range, using the specified seed value
Return Type : int
Static : Yes
Namespace : StandardLibrary.int
Parameters
Name | Data Type | Description |
---|---|---|
seed | int | The seed (starting value) to use in the pseudo-random algorithm |
from | int | The lower bound of the random number (inclusive) |
to | int | The upper bound of the random number (exclusive!) |
Syntax
Collection[int] randomNumbers;
//3 random numbers ranging from 0 up to 9. Seed is 4
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(int.GetRandom(5, 0, 10));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [0, 10]: {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [0, 10]: {3, 3, 3}
//3 random numbers ranging from -10 up to 9. Seed is 0
randomNumbers.Clear();
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(int.GetRandom(147, -10, 10));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [-10, 10]: {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [-10, 10]: {0, 0, 0}
ToString(string)¶
Description
Returns the integer into its equivalent string representation, using the specified format
Return Type : string
Static : No
Namespace : StandardLibrary.int
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format to use while stringifying the integer |
Syntax
int integer = 14700;
DebugLib.Logger.WriteInfoLine(integer + ".ToString('G') = "+ integer.ToString("G")); //14700.ToString('G') = 14700
DebugLib.Logger.WriteInfoLine(integer + ".ToString('C') = "+ integer.ToString("C")); //14700.ToString('C') = $14,700.00
DebugLib.Logger.WriteInfoLine(integer + ".ToString('D8') = "+ integer.ToString("D8")); //14700.ToString('D8') = 00014700
DebugLib.Logger.WriteInfoLine(integer + ".ToString('E4') = "+ integer.ToString("E4")); //14700.ToString('E4') = 1.4700E+004
DebugLib.Logger.WriteInfoLine(integer + ".ToString('e3') = "+ integer.ToString("e3")); //14700.ToString('e3') = 1.470e+004
DebugLib.Logger.WriteInfoLine(integer + ".ToString('F') = "+ integer.ToString("F")); //14700.ToString('F') = 14700.00
DebugLib.Logger.WriteInfoLine(integer + ".ToString('N') = "+ integer.ToString("N")); //14700.ToString('N') = 14,700.00
DebugLib.Logger.WriteInfoLine(integer + ".ToString('P') = "+ integer.ToString("P")); //14700.ToString('P') = 1,470,000.00%
DebugLib.Logger.WriteInfoLine(integer + ".ToString('X') = "+ integer.ToString("X")); //14700.ToString('X') = 396C
DebugLib.Logger.WriteInfoLine(integer + ".ToString('0,0.000') = "+ integer.ToString("0,0.000")); //14700.ToString('0,0.000') = 14,700.000
DebugLib.Logger.WriteInfoLine(integer + ".ToString('#,#.00#;(#,#.00#)') = "+ integer.ToString("#,#.00#;(#,#.00#)")); //14700.ToString('#,#.00#;(#,#.00#)')
long¶
Description¶
Represents a 64-bit, signed integral number
Methods¶
ToString()¶
Description
Returns the equivalent string representation of this instance's numeric value
Return Type : string
Static : No
Namespace : StandardLibrary.long
Syntax
long aLong = 2147483640;
string myString = aLong.ToString(); //Here, myString is '2147483647'
aLong = aLong * -1;
myString = aLong.ToString(); //myString is now '-2147483647'
Parse(string)¶
Description
Converts a string representation of an integral number into its equivalent Long
Return Type : long
Static : Yes
Namespace : StandardLibrary.long
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string value to be converted into a long |
Syntax
DebugLib.Logger.WriteInfoLine(long.Parse("2147483640")); // 2147483640
DebugLib.Logger.WriteInfoLine(long.Parse("-2147483640")); // -2147483640
DebugLib.Logger.WriteInfoLine(long.Parse("2147483640,60")); //Will result in an Error
DebugLib.Logger.WriteInfoLine(long.Parse("no way")); //Will result in an Error
Parse(string, string)¶
Description
Converts a string representation of an integral number into its equivalent Long, formatted with respect to the specified locale
Return Type : long
Static : Yes
Namespace : StandardLibrary.long
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string value to be converted into a Long |
locale | string | The locale to be used while parsing the number |
Syntax
DebugLib.Logger.WriteInfoLine(long.Parse("2147483640", "en-us"));
DebugLib.Logger.WriteInfoLine(long.Parse("2147483640", "gr"));
DebugLib.Logger.WriteInfoLine(long.Parse("2147483640", "pa"));
ToString(string)¶
Description
Returns the Long into its equivalent string representation, using the specified format
Return Type : string
Static : No
Namespace : StandardLibrary.long
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format to use while stringifying the value |
Syntax
long aLong = 2147483640;
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('G') = "+ aLong.ToString("G")); //2147483640.ToString('G') = 2147483640
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('C') = "+ aLong.ToString("C")); //2147483640.ToString('C') = $2,147,483,640.00
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('D8') = "+ aLong.ToString("D8")); //2147483640.ToString('D8') = 2147483640
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('E4') = "+ aLong.ToString("E4")); //2147483640.ToString('E4') = 2.1475E+009
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('e3') = "+ aLong.ToString("e3")); //2147483640.ToString('e3') = 2.147e+009
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('F') = "+ aLong.ToString("F")); //2147483640.ToString('F') = 2147483640.00
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('N') = "+ aLong.ToString("N")); //2147483640.ToString('N') = 2,147,483,640.00
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('P') = "+ aLong.ToString("P")); //2147483640.ToString('P') = 214,748,364,000.00%
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('X') = "+ aLong.ToString("X")); //2147483640.ToString('X') = 2147483640.ToString('X') = 7FFFFFF8
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('0,0.000') = "+ aLong.ToString("0,0.000")); //2147483640.ToString('0,0.000') = 2,147,483,640.000
DebugLib.Logger.WriteInfoLine(aLong + ".ToString('#,#.00#;(#,#.00#)') = "+ aLong.ToString("#,#.00#;(#,#.00#)")); //2147483640.ToString('#,#.00#;(#,#.00#)') = 2,147,483,640.00
bool¶
Description¶
Represents a logical 'truth value': true or false
Methods¶
ToString()¶
Description
Converts the boolean value to its equivalent string representation
Return Type : string
Static : No
Namespace : StandardLibrary.bool
Syntax
bool yup = true;
bool nop = false;
DebugLib.Logger.WriteInfoLine(yup.ToString()); //True
DebugLib.Logger.WriteInfoLine(nop.ToString()); //False
Parse(string)¶
Description
Returns the string representation of the locigal 'truth value' into a Boolean
Return Type : bool
Static : Yes
Namespace : StandardLibrary.bool
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string to convert into a boolean |
Syntax
DebugLib.Logger.WriteInfoLine(bool.Parse("True")); //true
DebugLib.Logger.WriteInfoLine(bool.Parse("False")); //false
DebugLib.Logger.WriteInfoLine(bool.Parse("true")); //true
DebugLib.Logger.WriteInfoLine(bool.Parse("false")); //false
DebugLib.Logger.WriteInfoLine(bool.Parse("No way. No.")); //System.FormatException: String was not recognized as a valid Boolean.
DebugLib.Logger.WriteInfoLine(bool.Parse(null)); //System.ArgumentNullException: Value cannot be null.
float¶
Description¶
Represents a 32-bit, signed, floating-point number
Methods¶
ToString()¶
Description
Returns the equivalent string representation of this instance's numeric value
Return Type : string
Static : No
Namespace : StandardLibrary.float
Syntax
long aFloat = 21474,83640;
string myString = aFloat.ToString(); //Here, myString is '21474,83647'
aFloat = aFloat * -1;
myString = aFloat.ToString(); //myString is now '-21474,83647'
Parse(string)¶
Description
Converts a string representation of a floating-point number into its equivalent float
Return Type : float
Static : Yes
Namespace : StandardLibrary.float
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string to be converted to a float. The floating-point is a dot (.), e.g. 12.00 , 14.75 |
Syntax
DebugLib.Logger.WriteInfoLine(float.Parse("147")); //147
DebugLib.Logger.WriteInfoLine(float.Parse("14.7")); //14.7
DebugLib.Logger.WriteInfoLine(float.Parse("-12.349")); //-12.349
DebugLib.Logger.WriteInfoLine(float.Parse("14,7")); //System.FormatException: Input string was not in a correct format.
DebugLib.Logger.WriteInfoLine(float.Parse("xxx")); //System.FormatException: Input string was not in a correct format.
Parse(string, string)¶
Description
Converts a string representation of a floating-point number into its equivalent float, formatted with respect to the specified locale
Return Type : float
Static : Yes
Namespace : StandardLibrary.float
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string value to be converted into a float |
locale | string | The locale to be used while parsing the number |
Syntax
DebugLib.Logger.WriteInfoLine(float.Parse("2147483.640", "en-us"));
DebugLib.Logger.WriteInfoLine(float.Parse("21474836.40", "gr"));
DebugLib.Logger.WriteInfoLine(float.Parse("214748.3640", "pa"));
ToString(string)¶
Description
Returns the Long into its equivalent string representation, using the specified format
Return Type : string
Static : No
Namespace : StandardLibrary.float
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format to use while stringifying the value |
Syntax
float aFloat = float.Parse("2147483.640");
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('G') = "+ aFloat.ToString("G")); //2147484.ToString('G') = 2147484
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('C') = "+ aFloat.ToString("C")); //2147484.ToString('C') = $2,147,484.00
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('E4') = "+ aFloat.ToString("E4")); //2147484.ToString('E4') = 2.1475E+006
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('e3') = "+ aFloat.ToString("e3")); //2147484.ToString('e3') = 2.147e+006
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('F') = "+ aFloat.ToString("F")); //2147484.ToString('F') = 2147484.00
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('N') = "+ aFloat.ToString("N")); //2147484.ToString('N') = 2,147,484.00
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('P') = "+ aFloat.ToString("P")); //2147484.ToString('P') = 214,748,400.00%
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('0,0.000') = "+ aFloat.ToString("0,0.000")); //2147484.ToString('0,0.000') = 2,147,484.000
DebugLib.Logger.WriteInfoLine(aFloat + ".ToString('#,#.00#;(#,#.00#)') = "+ aFloat.ToString("#,#.00#;(#,#.00#)")); //2147484.ToString('#,#.00#;(#,#.00#)') = 2,147,484.00
char¶
Description¶
Represents a single character
TimeSpan¶
Description¶
Represents a time interval
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Days | int | No | No | Gets the Days part of the time interval, represented by the current TimeSpan object |
Hours | int | No | No | Gets the Hours part of the time interval, represented by the current TimeSpan object |
Minutes | int | No | No | Gets the Minutes part of the time interval, represented by the current TimeSpan object |
Seconds | int | No | No | Gets the Seconds part of the time interval, represented by the current TimeSpan object |
Milliseconds | int | No | No | Gets the Milliseconds part of the time interval, represented by the current TimeSpan object |
TotalDays | double | No | No | Gets the time, represented by the current TimeSpan object, in total Days (whole and fractional) |
TotalHours | double | No | No | Gets the time, represented by the current TimeSpan object, in total Hours (whole and fractional) |
TotalMinutes | double | No | No | Gets the time, represented by the current TimeSpan object, in total Minutes (whole and fractional) |
TotalSeconds | double | No | No | Gets the time, represented by the current TimeSpan object, in total Seconds (whole and fractional) |
TotalMilliseconds | double | No | No | Gets the time, represented by the current TimeSpan object, in total Milliseconds (whole and fractional) |
Methods¶
Parse(string)¶
Description
Converts the stringified time interval into its respective TimeSpan.
Return Type : TimeSpan
Static : Yes
Namespace : StandardLibrary.TimeSpan
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string, representing a time interval |
Syntax
string timeString = "12:59:30.147";
TimeSpan timeSpan = TimeSpan.Parse(timeString);
DebugLib.Logger.WriteInfoLine(timeSpan); //12:59:30.1470000
ToString(string)¶
Description
Converts the time interval into a string, using the specified format provider
Return Type : string
Static : No
Namespace : StandardLibrary.TimeSpan
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format provider to use while converting |
Syntax
string timeString = "12:59:30.147";
TimeSpan timeSpan = TimeSpan.Parse(timeString);
DebugLib.Logger.WriteInfoLine(timeSpan.ToString("c"));
DebugLib.Logger.WriteInfoLine(timeSpan.ToString("g"));
DebugLib.Logger.WriteInfoLine(timeSpan.ToString("G"));
DebugLib.Logger.WriteInfoLine(timeSpan.ToString("hh\\:mm\\:ss"));
DebugLib.Logger.WriteInfoLine(timeSpan.ToString("%m' min."));
DateTime¶
Description¶
Represents time, expressed as a date and time of day
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Date | DateTime | No | No | The Date part of the current DateTime |
DayOfTheWeek | int | No | No | The number of week day (0 = Sunday) |
Methods¶
ToString(string, Domain.ApplicationLanguage)¶
Description
Returns a string formatted according to the provided format and Language
Return Type : string
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
format | string | A string that defines the format to be applied. |
culture | Domain.ApplicationLanguage | A Domain.ApplicationLanguage class instance that defines the formatting's culture |
Syntax
string dateStr = now.ToString("MM/dd/yyyy hh:mm tt", AppLib.Session.CurrentLanguage); // 05/29/2015 05:50 AM
Now()¶
Description
Returns a DateTime object set to the current, local time of the Computer that called the function.
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Syntax
var now = DateTime.Now(); /* 2/28/2018 10:06:08 AM */
Today()¶
Description
Returns the current Date
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Syntax
var now = DateTime.Today(); /* 2/28/2018 12:00:00 AM -> The Time part is set to midday by default */
Second()¶
Description
Returns the Seconds part of the time represented by this instance
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Syntax
/* 2/28/2018 10:12:04 AM */
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now);
/* Seconds part of [2/28/2018 10:12:04 AM] is: 4 */
DebugLib.Logger.WriteInfoLine("Seconds part of ["+now+"] is: "+ now.Second());
Minute()¶
Description
Returns the Minutes part of the time represented by this instance
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Syntax
/* 2/28/2018 10:12:04 AM */
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now);
/* Minutes part of [2/28/2018 10:12:04 AM] is: 12 */
DebugLib.Logger.WriteInfoLine("Minutes part of ["+now+"] is: "+ now.Minute());
Hour()¶
Description
Returns the Hours part of the time represented by this instance
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Syntax
/* 2/28/2018 10:12:04 AM */
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now);
/* Hours part of [2/28/2018 10:12:04 AM] is: 10 */
DebugLib.Logger.WriteInfoLine("Hours part of ["+now+"] is: "+ now.Hour());
Day()¶
Description
Returns the Day part of the date represented by this instance
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Syntax
/* 2/28/2018 10:12:04 AM */
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now);
/* Day part of [2/28/2018 10:12:04 AM] is: 28 */
DebugLib.Logger.WriteInfoLine("Day part of ["+now+"] is: "+ now.Day());
Month()¶
Description
Returns the Month part of the date represented by this instance
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Syntax
/* 2/28/2018 10:12:04 AM */
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now);
/* Month part of [2/28/2018 10:12:04 AM] is: 2 */
DebugLib.Logger.WriteInfoLine("Month part of ["+now+"] is: "+ now.Month());
Year()¶
Description
Returns the Year part of the date represented by this instance
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Syntax
/* 2/28/2018 10:12:04 AM */
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now);
/* Year part of [2/28/2018 10:12:04 AM] is: 2018 */
DebugLib.Logger.WriteInfoLine("Year part of ["+now+"] is: "+ now.Year());
HasValue()¶
Description
Examines whether the current instance has a value or not. True, means that it has a value. False, means that it is probably NULL
Return Type : bool
Static : No
Namespace : StandardLibrary.DateTime
Syntax
// Initialized and Set DateTime
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now.HasValue()); //True
// Null DateTime
now = null;
DebugLib.Logger.WriteInfoLine(now.HasValue()); //False
// Unset DateTime
DateTime never;
DebugLib.Logger.WriteInfoLine(never.HasValue()); //False
GetDiff(DateTime, DateTime)¶
Description
Returns the difference, expressed as a Time Interval (TimeSpan) between two DateTime instances
Return Type : TimeSpan
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
dateTime1 | DateTime | |
dateTime2 | DateTime |
Syntax
//Get the time
DateTime now = DateTime.Now();
//wait for 10 seconds
CommonLib.Utilities.Sleep(10000);
//Get the time again
DateTime tenSecondsLater = DateTime.Now();
//Get the Time Interval that passed
DebugLib.Logger.WriteInfoLine(DateTime.GetDiff(now, tenSecondsLater)); //Time Interval: 00:00:10.0006028
DebugLib.Logger.WriteInfoLine(DateTime.GetDiff(tenSecondsLater, now)); //Time Interval: -00:00:10.0006028
Create(int, int, int)¶
Description
Returns a new DateTime instance, created using the specified Date expressed in Years, Months and Days
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
year | int | The Year to be set on the new instance |
month | int | The Month to be set on the new instance |
day | int | The Day to be set on the new instance |
Syntax
/* John Cleese's Birdate: 27.10.1939 */
var birth = DateTime.Create(1939, 10, 27);
DebugLib.Logger.WriteInfoLine("John Cleese, aka Tim the Enchanter, was born on: " + birth);
/* Johnohn Cleese, aka Tim the Enchanter, was born on: 10/27/1939 12:00:00 AM */
Create(int, int, int, int, int, int)¶
Description
Returns a new DateTime instance, created using the specified Date and Time expressed in Years, Months, Days, Hours, Minutes and Seconds
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
year | int | The Year to be set on the new instance |
month | int | The Month to be set on the new instance |
day | int | The Day to be set on the new instance |
hour | int | The Hour to be set on the new instance |
minute | int | The Minutes to be set on the new instance |
second | int | The Seconds to be set on the new instance |
Syntax
/* John Cleese's Birdate: 27.10.1939 at 03.15 */
var birth = DateTime.Create(1939, 10, 27, 3, 15, 0);
DebugLib.Logger.WriteInfoLine("John Cleese, aka Tim the Enchanter, was born on: " + birth);
/* John Cleese, aka Tim the Enchanter, was born on: 10/27/1939 3:15:00 AM */
ParseExact(string, string)¶
Description
Parses/Converts a stringified Datetime, using the expected format, and returns its relevant DateTime instance
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
dateTime | string | The date and time, expressed as a string (e.g. 1939/10/27) |
format | string | The format used in the string (e.g. yyyy/MM/dd) |
Syntax
DebugLib.Logger.WriteInfoLine(DateTime.ParseExact("1939/10/27", "yyyy/MM/dd"));
/* Parsed as 10/27/1939 12:00:00 AM, using only the date*/
DebugLib.Logger.WriteInfoLine(DateTime.ParseExact("1939/10/27 03:15", "yyyy/MM/dd hh:mm"));
/* Parsed as 10/27/1939 3:15:00 AM, using only the date*/
DebugLib.Logger.WriteInfoLine(DateTime.ParseExact("39/10", "yy/mm/dd"));
/* Parsed as 1/1/1939 12:10:00 AM, since the Date given and the Format did not match. No exception was thrown */
DebugLib.Logger.WriteInfoLine(DateTime.ParseExact("We are the knights who say NI", "yy/mm/dd hh:mm:ss"));
/* Parsed as 1/1/1939 12:10:00 AM, since the Date was awfully wrong. No exception was thrown */
ParseExact(string, string, Domain.ApplicationLanguage)¶
Description
Parses a string to DateTime according to a specific format and language
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
dateTime | string | A formatted DateTime string |
format | string | A string that defines the format of the date string to be parsed. |
locale | Domain.ApplicationLanguage | A Domain.ApplicationLanguage class instance that defines the culture of the date string to be parsed. |
Syntax
DateTime dt = DateTime.ParseExact("30/04/1984", "dd/MM/yyyy", AppLib.Session.CurrentLanguage);
Compare(DateTime, DateTime)¶
Description
Returns the comparison result between two DateTime objects. -1 means that the first DateTime is smaller than the second. 1 means that the first is higher than the second. 0 denotes equality
Return Type : int
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
dateTime1 | DateTime | |
dateTime2 | DateTime |
Syntax
DateTime birth_RobertDeNiro = DateTime.Create(1943, 8, 17, 3, 0, 0);
DateTime birth_Gerard_Depardieu = DateTime.Create(1948, 12, 27, 08, 0, 0);
if(DateTime.Compare(birth_RobertDeNiro, birth_Gerard_Depardieu) == -1){
DebugLib.Logger.WriteInfoLine("Robert DeNiro is younger than Gerard Depardieu");
}
elseif(DateTime.Compare(birth_RobertDeNiro, birth_Gerard_Depardieu) == 1){
DebugLib.Logger.WriteInfoLine("Robert DeNiro is older than Gerard Depardieu");
}
else /* == 0 */ {
DebugLib.Logger.WriteInfoLine("Robert DeNiro and Gerard Depardieu are the same age. Who knew..");
}
/* Result: "Robert DeNiro is younger than Gerard Depardieu" */
CompareTo(DateTime)¶
Description
Returns the comparison result between the current DateTime instance and another. -1 means that current instance is smaller than the other. 1 means that current instance is higher than the other. 0 denotes equality
Return Type : int
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
OtherDate | DateTime | A DateTime instance to be used for comparison |
Syntax
DateTime dt = DateTime.ParseExact("30/04/1984", "dd/MM/yyyy", AppLib.Session.CurrentLanguage);
var x = dt.CompareTo(DateTime.Now()); // value will be -1
x = dt.CompareTo(dt); // value will be 0
x = DateTime.Now().CompareTo(dt); // value will be 1
DaysInMonth(int, int)¶
Description
Returns the days that a specified Month has, or had, in a specific Year
Return Type : int
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
year | int | The Year, whose month's days are required |
month | int | The month whose number of days are examined |
Syntax
//January of 2018 had 31 days
DebugLib.Logger.WriteInfoLine("January of 2018 had " + DateTime.DaysInMonth(2018, 1) + " days");
//December of 2100 will have 31 days
DebugLib.Logger.WriteInfoLine("December of 2100 will have " + DateTime.DaysInMonth(2100, 1) + " days");
//February of 2018 had 28 days
DebugLib.Logger.WriteInfoLine("February of 2018 had " + DateTime.DaysInMonth(2018, 2) + " days");
//March of 2018 had 31 days
DebugLib.Logger.WriteInfoLine("March of 2018 had " + DateTime.DaysInMonth(2018, 3) + " days");
//February of 2017 had 28 days
DebugLib.Logger.WriteInfoLine("February of 2017 had " + DateTime.DaysInMonth(2017, 2) + " days");
//February of 2016 had 29 days
DebugLib.Logger.WriteInfoLine("February of 2016 had " + DateTime.DaysInMonth(2016, 2) + " days");
// February of 2015 had 28 days
DebugLib.Logger.WriteInfoLine("February of 2015 had " + DateTime.DaysInMonth(2015, 2) + " days");
AddDays(double)¶
Description
Adds (or subtracts) a specified number of days into (or from) a DateTime and returns the new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
days | double | Number of days to add (use negative values for subtraction) |
Syntax
var aDate = DateTime.Create(2000, 1, 1);
//My date: 1/1/2000 12:00:00 AM
DebugLib.Logger.WriteInfoLine("My date: "+ aDate);
//10 days later: 1/11/2000 12:00:00 AM
DebugLib.Logger.WriteInfoLine("10 days later: "+ aDate.AddDays(10));
//20 days before: 12/7/1999 12:00:00 AM
DebugLib.Logger.WriteInfoLine("20 days before: "+ aDate.AddDays(-25));
AddYears(int)¶
Description
Adds (or subtracts) a specified number of years into (or from) a DateTime and returns the new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
years | int | Number of years to add (use negative values for subtraction) |
Syntax
var aDate = DateTime.Create(2000, 1, 1);
//My date: 1/1/2000 12:00:00 AM
DebugLib.Logger.WriteInfoLine("My date: "+ aDate);
//10 years later: 1/1/2010 12:00:00 AM
DebugLib.Logger.WriteInfoLine("10 years later: "+ aDate.AddYears(10));
//20 years before: 1/1/1975 12:00:00 AM
DebugLib.Logger.WriteInfoLine("20 years before: "+ aDate.AddYears(-25));
AddMonths(int)¶
Description
Adds (or subtracts) a specified number of months into (or from) a DateTime and returns the new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
months | int | Number of months to add (use negative values for subtraction) |
Syntax
var aDate = DateTime.Create(2000, 1, 1);
//My date: 1/1/2000 12:00:00 AM
DebugLib.Logger.WriteInfoLine("My date: "+ aDate);
//10 months later: 11/1/2000 12:00:00 AM
DebugLib.Logger.WriteInfoLine("10 months later: "+ aDate.AddMonths(10));
//20 months before: 12/1/1997 12:00:00 AM
DebugLib.Logger.WriteInfoLine("20 months before: "+ aDate.AddMonths(-25));
AddHours(int)¶
Description
Adds (or subtracts) a specified number of hours into (or from) a DateTime and returns the new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
hours | int | Number of hours to add (use negative values for subtraction) |
Syntax
var aDate = DateTime.Create(2000, 1, 1, 12, 12, 50);
//My date: 1/1/2000 12:12:50 PM
DebugLib.Logger.WriteInfoLine("My date: "+ aDate);
//10 hours later: 1/1/2000 10:12:50 PM
DebugLib.Logger.WriteInfoLine("10 hours later: "+ aDate.AddHours(10));
//20 hours before: 12/31/1999 11:12:50 AM
DebugLib.Logger.WriteInfoLine("20 hours before: "+ aDate.AddHours(-25));
AddMinutes(double)¶
Description
Adds (or subtracts) a specified number of minutes into (or from) a DateTime and returns the new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
minutes | double | Number of minutes to add (use negative values for subtraction) |
Syntax
var aDate = DateTime.Create(2000, 1, 1, 12, 12, 50);
//My date: 1/1/2000 12:12:50 PM
DebugLib.Logger.WriteInfoLine("My date: "+ aDate);
//10 minutes later: 1/1/2000 12:22:50 PM
DebugLib.Logger.WriteInfoLine("10 minutes later: "+ aDate.AddMinutes(10));
//20 minutes before: 1/1/2000 11:47:50 AM
DebugLib.Logger.WriteInfoLine("20 minutes before: "+ aDate.AddMinutes(-25));
AddSeconds(double)¶
Description
Adds (or subtracts) a specified number of seconds into (or from) a DateTime and returns the new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
seconds | double | Number of seconds to add (use negative values for subtraction) |
Syntax
var aDate = DateTime.Create(2000, 1, 1, 12, 12, 50);
//My date: 1/1/2000 12:12:50 PM
DebugLib.Logger.WriteInfoLine("My date: "+ aDate);
//10 seconds later: 1/1/2000 12:13:00 PM
DebugLib.Logger.WriteInfoLine("10 seconds later: "+ aDate.AddSeconds(10));
//20 seconds before: 1/1/2000 12:12:25 PM
DebugLib.Logger.WriteInfoLine("20 seconds before: "+ aDate.AddSeconds(-25));
Add(TimeSpan)¶
Description
Adds (or subtracts, if values are negative) a specified time interval from the DateTime instance and returns its new value
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
timeSpan | TimeSpan | The time interval to be added (or subtracted from) to the instance |
Syntax
var aDate = DateTime.Create(2000, 1, 1, 12, 0, 0);
var futureTimeSpan = TimeSpan.Parse("1:30:00.000");
//My Date: 1/1/2000 12:00:00 PM
DebugLib.Logger.WriteInfoLine("My Date: " + aDate);
//1.5 Hours After: 1/1/2000 1:30:00 PM
DebugLib.Logger.WriteInfoLine("1.5 Hours After: " + aDate.Add(futureTimeSpan));
FromUnixTime(long)¶
Description
Creates a DateTime based on a Unix time, which is defined as the number of seconds since midnight (UTC) on 1st January 1970
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
unixTime | long | Date and Time, expressed in Unix Time (number of seconds passed since 1970/01/01 00:00:00 UTC) |
ToUnixTime()¶
Description
Converts the DateTime to a Unix time, which is defined as the number of seconds since midnight (UTC) on 1st January 1970
Return Type : long
Static : No
Namespace : StandardLibrary.DateTime
Syntax
long unixTime = 1519823201;
DebugLib.Logger.WriteInfoLine(DateTime.FromUnixTime(unixTime)); //2/28/2018 1:06:41 PM
ToUTC()¶
Description
Converts the current DateTime instance to its UTC format
Return Type : DateTime
Static : No
Namespace : StandardLibrary.DateTime
Syntax
DateTime now = DateTime.Now();
DebugLib.Logger.WriteInfoLine(now); //2/28/2018 1:09:10 PM
DebugLib.Logger.WriteInfoLine(now.ToUTC()); //2/28/2018 11:09:10 AM
GetMinValue()¶
Description
Returns a DateTime instance holding the smallest possible value of a date and time
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Syntax
DateTime.GetMinValue(); //1/1/0001 12:00:00 AM
GetMaxValue()¶
Description
Returns a DateTime instance holding the highest possible value of a date and time
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Syntax
DateTime.GetMaxValue(); //12/31/9999 11:59:59 PM
GetMinSqlValue()¶
Description
Returns a DateTime instance holding the smallest possible value of a date and time that can be used in an SQL Database
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Syntax
DateTime.GetMinSqlValue(); //1/1/1753 12:00:00 AM
Parse(string)¶
Description
Parses a date and time, represented by a string, typically in a [yyyy/MM/dd hhss] format and returns its new DateTime instance
Return Type : DateTime
Static : Yes
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
value | string | String, representing a date and time, typically in a [yyyy/MM/dd hhss] format |
Syntax
DebugLib.Logger.WriteInfoLine(DateTime.Parse("10:25:01"));
//2/28/2018 10:25:01 AM
DebugLib.Logger.WriteInfoLine(DateTime.Parse("2050/12/31"));
//12/31/2050 12:00:00 AM
DebugLib.Logger.WriteInfoLine(DateTime.Parse("2050/12/31 10:25:01"));
//12/31/2050 10:25:01 AM
DebugLib.Logger.WriteInfoLine(DateTime.Parse("31/12/2050 10:25:01"));
//System.FormatException: String was not recognized as a valid DateTime.
ToString(string)¶
Description
Converts the DateTime instance to its string representation, following the required format
Return Type : string
Static : No
Namespace : StandardLibrary.DateTime
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format to use in the final string (eg. 'yyyy/MM/dd hhss') |
Syntax
DateTime now = DateTime.Now(); //2/28/2018 1:21:12 PM
now.ToString("yyyy/MM/dd"); //2018/02/28
now.ToString("yy/MM/dd");// 18/02/28
now.ToString("dd.MM.yy hh:mm:ss");// 28.02.18 01:21:12
now.ToString("dd.MM.yy HH:mm:ss");// 28.02.18 13:21:12
double¶
Description¶
Represents a signed, double-precision, floating-point number
Methods¶
ToString()¶
Description
Returns the equivalent string representation of this instance's numeric value
Return Type : string
Static : No
Namespace : StandardLibrary.double
Syntax
double pi = CommonLib.Math.Pi();
string myString = pi.ToString(); //Here, myString is '3.14159265358979'
Parse(string)¶
Description
Return Type : double
Static : Yes
Namespace : StandardLibrary.double
Parameters
Name | Data Type | Description |
---|---|---|
value | string | A double value, written as a string. Use a dot (.) as your floating point |
Syntax
double.Parse("3.14159265358979"); //3.14159265358979
double.Parse("3.14"); //3.14
double.Parse("2.1700"); // 2.17
double.Parse("2,1700"); //21700. Did what it could, huh?
double.Parse("We are the knight who say NI"); // System.FormatException: Input string was not in a correct format.
Parse(string, string)¶
Description
Parses the double value, represented as a string, using the specified locale. Note: Throws an exception if the string is in an incorrect format
Return Type : double
Static : Yes
Namespace : StandardLibrary.double
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string representation of a double number |
locale | string | The locale to use, while parsing the string value (e.g. en-us) |
Syntax
double.Parse("3.14159265358979", "en-us"); //3.14159265358979
double.Parse("3.14", "en-us"); //3.14
double.Parse("2.1700", "en-us"); //2.17
ToString(string)¶
Description
Converts the value of the Double into a string, using the specified format
Return Type : string
Static : No
Namespace : StandardLibrary.double
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format to use for the final stringified result |
Syntax
double aDouble = double.Parse("2147483.640");
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('G') = "+ aDouble.ToString("G"));
//2147483.64.ToString('G') = 2147483.64
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('C') = "+ aDouble.ToString("C"));
//2147483.64.ToString('C') = $2,147,483.64
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('E4') = "+ aDouble.ToString("E4"));
//2147483.64.ToString('E4') = 2.1475E+006
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('e3') = "+ aDouble.ToString("e3"));
//2147483.64.ToString('e3') = 2.147e+006
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('F') = "+ aDouble.ToString("F"));
//2147483.64.ToString('F') = 2147483.64
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('N') = "+ aDouble.ToString("N"));
//2147483.64.ToString('N') = 2,147,483.64
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('P') = "+ aDouble.ToString("P"));
//2147483.64.ToString('P') = 214,748,364.00%
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('0,0.000') = "+ aDouble.ToString("0,0.000"));
//2147483.64.ToString('0,0.000') = 2,147,483.640
DebugLib.Logger.WriteInfoLine(aDouble + ".ToString('#,#.00#;(#,#.00#)') = "+ aDouble.ToString("#,#.00#;(#,#.00#)"));
//2147483.64.ToString('#,#.00#;(#,#.00#)') = 2,147,483.64
decimal¶
Description¶
Represents a decimal number
Methods¶
ToString()¶
Description
Returns the equivalent string representation of this instance's numeric value
Return Type : string
Static : No
Namespace : StandardLibrary.decimal
Syntax
decimal pi = 3.14;
ShowMessage(pi.ToString());
Parse(string)¶
Description
Converts a string representation of a floating-point number into its equivalent decimal number
Return Type : decimal
Static : Yes
Namespace : StandardLibrary.decimal
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string representing a decimal number |
Syntax
decimal.Parse("1024"); // 1024
decimal.Parse("3.14"); // 3.14
decimal.Parse("3.14158"); // 3.14158
decimal.Parse("3,14158"); // 314158
decimal.Parse("You're a wizard, Harry.."); //System.FormatException: Input string was not in a correct format.
Parse(string, string)¶
Description
Converts a string representation of a floating-point number into its equivalent float, formatted using the specified locale
Return Type : decimal
Static : Yes
Namespace : StandardLibrary.decimal
Parameters
Name | Data Type | Description |
---|---|---|
value | string | The string value to be converted into a decimal |
locale | string | The locale to be used while parsing the number |
Syntax
DebugLib.Logger.WriteInfoLine(float.Parse("2147483.640", "en-us"));
DebugLib.Logger.WriteInfoLine(float.Parse("21474836.40", "gr"));
DebugLib.Logger.WriteInfoLine(float.Parse("214748.3640", "pa"));
GetRandom(int, decimal, decimal)¶
Description
Returns a pseudo-random decimal within a specified range, using the specified seed value
Return Type : decimal
Static : Yes
Namespace : StandardLibrary.decimal
Parameters
Name | Data Type | Description |
---|---|---|
seed | int | The seed (starting value) to use in the pseudo-random algorithm |
from | decimal | The lower bound of the random number (inclusive) |
to | decimal | The upper bound of the random number (exclusive!) |
Syntax
Collection[decimal] randomNumbers;
//3 random numbers ranging from 0.1 up to 9.9 with seed [150]
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(decimal.GetRandom(150, 0, 10));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [0.1 , 9,9): {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [0.1 , 9,9): {0.9004039833789710, 0.9004039833789710, 0.9004039833789710}
//3 random numbers ranging from -91.2 up to 105.3 with seed [2]
randomNumbers.Clear();
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(decimal.GetRandom(2, -91.2 , 105.3));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [-91.2 , 105.3): {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [-91.2 , 105.3): {102.0724239666817866, 102.0724239666817866, 102.0724239666817866}
GetRandom(decimal, decimal)¶
Description
Returns a pseudo-random integer within a specified range
Return Type : decimal
Static : Yes
Namespace : StandardLibrary.decimal
Parameters
Name | Data Type | Description |
---|---|---|
from | decimal | The lower bound of the random number (inclusive) |
to | decimal | The upper bound of the random number (exclusive!) |
Syntax
Collection[decimal] randomNumbers;
//3 random numbers ranging from 0.1 up to 9.9
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(decimal.GetRandom(0, 10));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [0.1 , 9,9): {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [0.1 , 9,9): {0.08121093273219230, 0.08121093273219230, 0.08121093273219230}
//3 random numbers ranging from -91.2 up to 105.3
randomNumbers.Clear();
for int i = 0; i < 3; i + 1 {
randomNumbers.Add(decimal.GetRandom(-91.2 , 105.3));
}
DebugLib.Logger.WriteInfoLine("3 Random Numbers in [-91.2 , 105.3): {"+string.Join(", ", randomNumbers)+"}");
//3 Random Numbers in [-91.2 , 105.3): {96.818717079292386, 96.818717079292386, 96.818717079292386}
ToString(string)¶
Description
Returns the decimal converted to its equivalent string representation, using the specified format
Return Type : string
Static : No
Namespace : StandardLibrary.decimal
Parameters
Name | Data Type | Description |
---|---|---|
format | string | The format to use while stringifying the value |
Syntax
decimal aDecimal = decimal.Parse("2147483.640");
aDecimal + ".ToString('G') = "+ aDecimal.ToString("G"); // 2147483.640.ToString('G') = 2147483.640
aDecimal + ".ToString('C') = "+ aDecimal.ToString("C"); //2147483.640.ToString('C') = $2,147,483.64
aDecimal + ".ToString('E4') = "+ aDecimal.ToString("E4"); //2147483.640.ToString('E4') = 2.1475E+006
aDecimal + ".ToString('e3') = "+ aDecimal.ToString("e3"); // 2147483.640.ToString('e3') = 2.147e+006
aDecimal + ".ToString('F') = "+ aDecimal.ToString("F"); //2147483.640.ToString('F') = 2147483.64
aDecimal + ".ToString('N') = "+ aDecimal.ToString("N"); //2147483.640.ToString('N') = 2,147,483.64
aDecimal + ".ToString('P') = "+ aDecimal.ToString("P"); //2147483.640.ToString('P') = 214,748,364.00%
aDecimal + ".ToString('0,0.000') = "+ aDecimal.ToString("0,0.000"); //2147483.640.ToString('0,0.000') = 2,147,483.640
aDecimal + ".ToString('#,#.00#;(#,#.00#)') = "+ aDecimal.ToString("#,#.00#;(#,#.00#)"); //2147483.640.ToString('#,#.00#;(#,#.00#)') = 2,147,483.64
Exception¶
Description¶
Represents an Error that occured during the Application's execution
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Message | string | No | Yes | Gets a short message describing the current exception |
StackTrace | string | No | Yes | Gets the frames on the call stack where the exception occured |
BusinessException¶
Description¶
Represents a business (non-technical) exception instance.
Methods¶
Create(string)¶
Description
Returns a new BusinessException instance, using the provided message.
Return Type : BusinessException
Static : Yes
Namespace : StandardLibrary.BusinessException
Parameters
Name | Data Type | Description |
---|---|---|
message | string | The message that describes the exception |
Syntax
if (Model.NewUser.UserName.length < 5) {
BusinessException x = BusinessException.Create("Username must be at least 5 characters long!");
throw x;
}
CollectionBase¶
Description¶
A versatile structure containing a number of objects, offering easy manipulation and handy operations. Used as the base class for other collection-based classes, like Collection, Array etc.
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Length | int | No | Yes | Gets the number of elements in the current collection or array |
Array¶
Description¶
Represents a fixed-length collection of objects. Provides functionality for getting, setting, searching and converting Arrays.
Generic Parameters¶
- T
Methods¶
Set(int, T)¶
Description
Finds, using a zero-based index/position, and element in the Array and changes it with a new element
Return Type : void
Static : No
Namespace : StandardLibrary.Array
Parameters
Name | Data Type | Description |
---|---|---|
position | int | Zero-based index, representing the position of the element to update |
element | T | The element to be inserted into the array |
Syntax
//Initialize an array of strings, containing 4 elements
Array[string] queen = {"Freddie", "Brian", "Roger", ""};
DebugLib.Logger.WriteInfoLine("The array now contains: " + string.Join(", ", queen));
//The array now contains: Freddie, Brian, Roger, ''
//Set the first element to "Freddie Mercury"
queen.Set(0, "Freddie Mercury");
DebugLib.Logger.WriteInfoLine("The array now contains: " + string.Join(", ", queen));
//The array now contains: Freddie Mercury, Brian, Roger, ''
//Set the last element to "John"
queen.Set(3, "John");
DebugLib.Logger.WriteInfoLine("The array now contains: " + string.Join(", ", queen));
//The array now contains: Freddie Mercury, Brian, Roger, John
//Change the last element to "John Deacon"
queen.Set(queen.Length - 1, "John Deacon");
DebugLib.Logger.WriteInfoLine("The array now contains: " + string.Join(", ", queen));
//The array now contains: Freddie Mercury, Brian, Roger, John Deacon
Get(int)¶
Description
Returnes the object at the given zero-based position, in the Array instance
Return Type : T
Static : No
Namespace : StandardLibrary.Array
Parameters
Name | Data Type | Description |
---|---|---|
position | int | Zero-based index representing the position of the element to be fetched |
Syntax
//Initialize an array of strings, containing 4 elements
Array[string] queen = {"Freddie", "Brian", "Roger", "John"};
for int position = 0; position < queen.Length; position + 1 {
DebugLib.Logger.WriteInfoLine("Index ["+position+"] of the array contains: " + queen.Get(position));
}
/* Displays:
Index [0] of the array contains: Freddie
Index [1] of the array contains: Brian
Index [2] of the array contains: Roger
Index [3] of the array contains: John
*/
ToCollection()¶
Description
Converts the current, fixed-length Array to a more comprehensive Collection instance
Return Type : Collection
Static : No
Namespace : StandardLibrary.Array
Syntax
//Initialize an array of strings, containing 2 elements.
Array[string] members = {"Freddie", "Brian"};
//Convert it to a Collection
Collection[string] queen = members.ToCollection();
//Now, add any number of new elements, freely
queen.Add("Roger");
queen.Add("Brian");
Contains(T)¶
Description
Checks whether the Array contains an element. Returns true, if the element is found. False, otherwise
Return Type : bool
Static : No
Namespace : StandardLibrary.Array
Parameters
Name | Data Type | Description |
---|---|---|
element | T | The element to look for |
Syntax
Array[string] queen = {"Freddie", "Brian", "John", "Roger"};
if(queen.Contains("Freddie") == true) {
DebugLib.Logger.WriteInfoLine("Well, of course Freddie is in Queen. What did you expect??");
}
if(queen.Contains("john") == false) {
DebugLib.Logger.WriteInfoLine("Well, John Deacon is in Queen, however you typed it with the wrong case. The search is case-sensitive!");
}
/*
Displays:
Well, of course Freddie is in Queen. What did you expect??
Well, John Deacon is in Queen, however you typed it with the wrong case. The search is case-sensitive!
*/
IndexOf(T)¶
Description
Performs a case-sensitive search and returns the zero-based position of the element, in the Array. -1 means that the element was not found.
Return Type : int
Static : No
Namespace : StandardLibrary.Array
Parameters
Name | Data Type | Description |
---|---|---|
element | T | The element to look for |
Syntax
Array[string] queen = {"Freddie", "Brian", "John", "Roger"};
int index;
index = queen.IndexOf("Freddie"); //index is 0
index = queen.IndexOf("Brian"); //index is 1
index = queen.IndexOf("roger"); //index is -1, due to case-sensitivity
index = queen.IndexOf(" I'm Going Slightly Mad"); //index is -1, obviously
Collection¶
Description¶
A versatile struct containing a number of instances of type T, that allows easy manipulation and offers handy operations.
Generic Parameters¶
- T
Methods¶
Add(T)¶
Description
Adds an element to the collection.
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
element | T | The element to be added to the collection |
Syntax
Collection[Domain.ApplicationUser] users;
users.Add(Domain.ApplicationUser.GetByKey("Admin"));
AddRange(Collection[T])¶
Description
Adds another collection of elements to the collection.
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
elements | Collection | The elements to be added to the collection |
Syntax
Collection[Domain.ApplicationUser] users;
users.AddRange(Domain.ApplicationUser.GetAll());
Single(Func[T, bool])¶
Description
Returns the only element of a sequence that satisfies a specified condition. Note. Throws an exception if there is not exactly one element in the collection.
Return Type : T
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser adminUser = users.Single(x => x.UserName == "Admin");
Select(Func[T, Object])¶
Description
Projects each element defined in the expression, into a new collection.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The Expression defining the elements to be selected |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[string] userNames = users.Select(x => x.UserName);
SelectMany(Func[T, Collection[Object]])¶
Description
Projects each collection of elements defined in the expression, into a new flattened collection.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The Expression defining the collection of elements to be selected |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationRole] userRoles = users.Select(x => x.Roles);
Min(Func[T, Object])¶
Description
Returns the minimum value within the collection, as defined in the expression.
Return Type : Object
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
expression | Func | The Expression defining the value to be checked |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int minUserNameLength = users.Min(x => x.UserName.Length) as int;
Max(Func[T, Object])¶
Description
Returns the minimum value within the collection, as defined in the expression.
Return Type : Object
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
expression | Func | The Expression defining the value to be checked |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int minUserNameLength = users.Min(x => x.UserName.Length) as int;
Set(int, T)¶
Description
Set an element at the specified (zero-based) index
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
index | int | The zero-based index to insert the element at |
element | T | The element to be inserted |
Syntax
Collection[Domain.ApplicationUser] users;
users.Set(0, Domain.ApplicationUser.GetByKey("Admin"));
AddAt(int, T)¶
Description
Add an element at the specified (zero-based) index
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
index | int | The zero-based index to insert the element at |
element | T | The element to be inserted |
Syntax
Collection[Domain.ApplicationUser] users;
users.AddAt(0, Domain.ApplicationUser.GetByKey("Admin"));
AddNew()¶
Description
Creates and adds a new Item to the collection
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[Domain.ApplicationUser] users;
users.AddNew();
AddManyNew(int)¶
Description
Creates many new elements as specified by the Count parameter and adds them to the collection.
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
Count | int | Specifies the number of new instances to be added |
Syntax
Collection[Domain.ApplicationUser] users;
users.AddManyNew(78);
Count(Func[T, bool])¶
Description
Returns the number of elements in the collection satisfying a condition
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users;
int usersWithRolesNumber = users.Count(x => x.Roles.Any());
Get(int)¶
Description
Returns the element at the specified position
Return Type : T
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
position | int | The zero-based index of the element to be returned |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser firstUser = users.Get(0);
Contains(T)¶
Description
Checks if an element is contained in a collection.
Return Type : bool
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
element | T | The element to check |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser firstUser = users.Get(0);
bool existsInCollection = users.Contains(firstUser); // true
Concat(Collection[T])¶
Description
Concatenates/Joins two collections.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
with | Collection |
Syntax
Collection[Domain.ApplicationUser] girls = Domain.ApplicationUser.GetFemales();
Collection[Domain.ApplicationUser] boys = Domain.ApplicationUser.GetMales();
Collection[Domain.ApplicationUser] all;
all.Concat(boys); // all now contains girls
all.Concat(girls); // all now contains girls and boys
Intersect(Collection[T])¶
Description
Returns the set intersection (common elements) of two collections.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
with | Collection | The collection to be intersected |
Syntax
Collection[Domain.ApplicationUser] adults = Domain.ApplicationUser.GetAdults();
Collection[Domain.ApplicationUser] boys = Domain.ApplicationUser.GetMales();
adults.Intersect(boys); // Now adults contains only adult boys
Clear()¶
Description
Clears/Empties the collection
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
users.Clear(); // nothing here now
FindIndex(Func[T, bool])¶
Description
Searches for an element (in the entire collection) that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the collection.
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int positionOfFirstAdmin = users.FindIndex(x => x.UserName.StartsWith("Admin"));
FindIndex(int, Func[T, bool])¶
Description
Searches for an element (starting from a specified part of the collection) that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the collection.
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
beginFrom | int | Search starting from this position |
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int positionOfFirstAdmin = users.FindIndex(5, x => x.UserName.StartsWith("Admin")); //Ignore the first 5 elements
FindLastIndex(Func[T, bool])¶
Description
Searches for an element (in the entire collection) that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the collection.
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int positionOfLastAdmin = users.FindLastIndex(x => x.UserName.StartsWith("Admin"));
FindLastIndex(int, Func[T, bool])¶
Description
Searches for an element (starting from a specified part of the collection) that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the collection.
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
beginFrom | int | Search starting from this position |
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int positionOfLastAdmin = users.FindLastIndex(x => x.UserName.StartsWith(1, "Admin")); //Ignore the first element while searching
IndexOf(T)¶
Description
Searches for the element and returns the zero-based index of its occurrence within the collection. Note: If element is not contained in the list, -1 is returned.
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
element | T | The element to search for |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int positionOfLastAdmin = users.IndexOf(Domain.ApplicationUser.GetByKey("Admin"));
Skip(int)¶
Description
Bypasses a specified number of elements in a collection and then returns the remaining elements.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
howMany | int | The number of elements to bypass |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] ignoreTopFive = users.Skip(5);
Take(int)¶
Description
Returns a specified number of contiguous elements from the start of a collection.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
howMany | int |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] topFive = users.Take(5);
Remove(T)¶
Description
Removes an element from the collection.
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
element | T | The element to remove |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser first = users.Get(0);
users.Remove(first); // now first user is removed
Where(Func[T, bool])¶
Description
Filters a collection based on a predicate and returns a new collection.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] usersWithRoles = users.Where(x => x.Roles.Any());
Except(Collection[T])¶
Description
Returns the set difference of two collections.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
These | Collection | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] boys = Domain.ApplicationUser.GetBoys();
Collection[Domain.ApplicationUser] girls = users.Except(boys);
First()¶
Description
Returns the element at the first position of the collection.
Return Type : T
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser first = users.First();
First(Func[T, bool])¶
Description
Returns the first element ecountered in the coolection that satisfies a condition.
Return Type : T
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser firstAdmin = users.First(x => x.UserName.StartsWith("Admin"));
Last()¶
Description
Returns the element at the last position of the collection.
Return Type : T
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Domain.ApplicationUser last = users.Last();
All(Func[T, bool])¶
Description
Checks if all elements inside a collection satisfy a condition.
Return Type : bool
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the condition applied |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
bool allUsersHaveRoles = users.All(x => x.Roles.Any());
Any(Func[T, bool])¶
Description
Checks if collection contains at least one element that satisfies a condition.
Return Type : bool
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
bool adminExists = users.Any(x => x.UserName == "Admin");
Any()¶
Description
Checks if collection contains at least one element
Return Type : bool
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
bool usersExist = users.Any();
Sum(Func[T, Object])¶
Description
Returns the sum of the sequence defined by an expression.
Return Type : int
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the sequence |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int totalAge = users.Sum(x => x.Age);
Average(Func[T, int])¶
Description
Returns the average value of a sequence of Integers, as a Double, defined by an expression.
Return Type : double
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the sequence |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int averageAge = users.Average(x => x.Age);
Average(Func[T, double])¶
Description
Returns the average value of a sequence of Doubles, as a Double, defined by an expression.
Return Type : double
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the sequence |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int averageAge = users.Average(x => x.Salary);
Average(Func[T, decimal])¶
Description
Returns the average value of a sequence of Decimals, as a Decimal, defined by an expression.
Return Type : decimal
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the sequence |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
int averageAge = users.Average(x => x.Salary);
OrderBy(Func[T, Object])¶
Description
Sorts the elements of a sequence in ascending order according to a key
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the key |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] youngToOld = users.OrderBy(x => x.Age);
ThenBy(Func[T, Object])¶
Description
Performs a subsequent ordering of the elements in a collection in ascending order according to a key.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the key |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] youngToOld = users.OrderBy(x => x.Age).ThenBy(x => x.UserName);
OrderByDescending(Func[T, Object])¶
Description
Sorts the elements of a sequence in descending order according to a key
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The predicate defining the key |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Collection[Domain.ApplicationUser] oldToYoung = users.OrderByDescending(x => x.Age);
ToArray()¶
Description
Returns an array containing all the elements of the collection
Return Type : Array
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
Array[Domain.ApplicationUser] usersArray = users.ToArray();
Distinct()¶
Description
Returns distinct (unique) elements from a collection.
Return Type : Collection
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[int] numbers;
numbers.Add(1);
numbers.Add(1);
numbers.Add(2);
numbers.Add(3);
numbers.Add(3);
Collection distinctNumbers = numbers.Distinct(); // [1, 2, 3]
Sort(Func[T, T, int])¶
Description
Sorts the elements of a collection according to a Comparer Function
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Parameters
Name | Data Type | Description |
---|---|---|
lambdaExpression | Func | The expression defining the way to sort the Elements |
Syntax
Collection[Domain.ApplicationUser] users = Domain.ApplicationUser.GetAll();
users.Sort((x,y)=> x.UserName.Length > y.UserName.Length ? -1 : 1); // sort by username length
Reverse()¶
Description
Inverts the order of the elements in a collection.
Return Type : void
Static : No
Namespace : StandardLibrary.Collection
Syntax
Collection[int] numbers;
numbers.Add(1);
numbers.Add(20);
numbers.Add(3);
numbers.Add(40);
numbers.Add(5);
numbers.Reverse(); // now numbers are [5, 40, 3, 20, 1]
Func¶
Description¶
Represents a method that accepts a paremter of T1 data type and returns a value of R data type
Generic Parameters¶
- T1
- R
Methods¶
Invoke()¶
Description
Invokes the method and returns the result
Return Type : R
Static : No
Namespace : StandardLibrary.Func
Syntax
MAMBA_DOCUMENTATION_TODO
IndexedCollection¶
Description¶
Represents a collection that contains objects that can be accessed via a Key Expression
Generic Parameters¶
- V
- K
Properties¶
Name | Data Type | Static | Readonly | Description |
---|---|---|---|---|
Length | int | No | No | Gets the items count of the collection |
Methods¶
SetKeyExpression(Func[V, K])¶
Description
Sets the key expression, which maps values to keys
Return Type : void
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
KeyExpression | Func |
Syntax
IndexedCollection[string, int] myIndexedCollection;
myIndexedCollection.SetKeyExpression(i => i.Length);
Add(V)¶
Description
Adds instance to the collection. If instance already exists it is updated
Return Type : void
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Instance | V |
AddRange(Collection[V])¶
Description
Adds instances to the collection. If an instance already exists it is updated
Return Type : void
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Instances | Collection |
Get(K)¶
Description
Returns the item corresponding to the provided key. If it does not exist null is returned
Return Type : V
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Key | K |
GetKeys()¶
Description
Returns all keys in the collection
Return Type : Collection
Static : No
Namespace : StandardLibrary.IndexedCollection
GetItems()¶
Description
Returns all items in the collection
Return Type : Collection
Static : No
Namespace : StandardLibrary.IndexedCollection
Remove(V)¶
Description
Removes the instance from the collection
Return Type : void
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Instance | V |
RemoveByKey(K)¶
Description
Removes the instances with the supplied key (if one exists)
Return Type : void
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Key | K |
Clear()¶
Description
Removes everything from the collection
Return Type : void
Static : No
Namespace : StandardLibrary.IndexedCollection
ContainsKey(K)¶
Description
Return Type : bool
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Key | K |
ContainsValue(V)¶
Description
Return Type : bool
Static : No
Namespace : StandardLibrary.IndexedCollection
Parameters
Name | Data Type | Description |
---|---|---|
Instance | V |
Predicate¶
Description¶
Represents an expression that checks if a condition is true or not
Generic Parameters¶
- T
Methods¶
Create(Func[T, bool])¶
Description
Returns a Predicate instance based on a Func
Return Type : Predicate
Static : No
Namespace : StandardLibrary.Predicate
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The func used to define the predicate |
Syntax
Predicate[Domain.ApplicationUser] myPredicate;
myPredicate = myPredicate.Create(x => x.UserName != null);
Or(Func[T, bool])¶
Description
Adds an OR part to a predicate and returns the combined predicate
Return Type : Predicate
Static : No
Namespace : StandardLibrary.Predicate
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The func used to define the OR part to be combined with the predicate |
Syntax
Predicate[Domain.ApplicationUser] myPredicate;
myPredicate = myPredicate.Create(x => x.UserName != null);
myPredicate.Or(x => x.Email != null).Or(x => x.EmailConfirmed);
And(Func[T, bool])¶
Description
Adds an ADD part to a predicate and returns the combined predicate
Return Type : Predicate
Static : No
Namespace : StandardLibrary.Predicate
Parameters
Name | Data Type | Description |
---|---|---|
predicate | Func | The func used to define the AND part to be combined with the predicate |
Syntax
Predicate[Domain.ApplicationUser] myPredicate;
myPredicate = myPredicate.Create(x => x.UserName != null);
myPredicate.And(x => x.Name != null).And(x => x.LockoutEndDate == null);
Dictionary¶
Description¶
Represent a collection containing key-value elements.
Generic Parameters¶
- K
- S
Methods¶
HasKey(K)¶
Description
Searches the key-value collection to see if a specified key exists. Returns False, if not.
Return Type : bool
Static : No
Namespace : StandardLibrary.Dictionary
Parameters
Name | Data Type | Description |
---|---|---|
key | K | The key, of type K, to be looked for |
Syntax
Dictionary[int, string] bands;
bands.Add(1, "Queen");
bands.Add(2, "Children of Bodom");
bands.Add(3, "Blind Guardian");
bands.Add(4, "Sonata Arctica");
bool key1Exists = bands.HasKey(1); //True
bool key9Exists = bands.HasHey(9); //False
Get(K)¶
Description
Retrieves the value of the element in the key-value collection, based on its key. If the key is not found in the Dictionary, a KeyNotFoundException is thrown.
Return Type : S
Static : No
Namespace : StandardLibrary.Dictionary
Parameters
Name | Data Type | Description |
---|---|---|
key | K | The key, of type K, to be looked for |
Syntax
Dictionary[int, string] bands;
bands.Add(1, "Queen");
bands.Add(2, "Children of Bodom");
bands.Add(3, "Blind Guardian");
bands.Add(4, "Sonata Arctica");
string queen = bands.Get(1); //queen = "Queen"
string nobody = bands.Get(9); //Throws a System.Collections.Generic.KeyNotFoundException
Set(K, S)¶
Description
Searches an element, based on its key, and changes its value. If the key used is not found, a new element is added
Return Type : S
Static : No
Namespace : StandardLibrary.Dictionary
Parameters
Name | Data Type | Description |
---|---|---|
key | K | The key, of type K, to be looked for |
value | S | The value, of type S, to be given to the found (or newlly added) element |
Syntax
Dictionary[int, string] bands;
bands.Add(1, "Queen");
bands.Add(2, "Children of Bodom");
bands.Add(3, "Blind Guardian");
bands.Add(4, "Sonata Arctica");
DebugLib.Logger.WriteInfoLine(bands.GetValues());
//{Queen, Children of Bodom, Blind Guardian, Sonata Arctica}
bands.Set(4, "Hammerfall");
DebugLib.Logger.WriteInfoLine(bands.GetValues());
//{Queen, Children of Bodom, Blind Guardian, Hammerfall}, with the 4th element changed
bands.Set(9, "Iron Maiden");
DebugLib.Logger.WriteInfoLine(bands.GetValues());
//{Queen, Children of Bodom, Blind Guardian, Hammerfall, Iron Maiden} with a new key-value added
Add(K, S)¶
Description
Adds a new key-value pair in the Dictionary. If a key is used more than once, throws a System.ArgumentException
Return Type : void
Static : No
Namespace : StandardLibrary.Dictionary
Parameters
Name | Data Type | Description |
---|---|---|
key | K | The key, of type K, to be given to the new element |
value | S | The value, of type S, to be given to the new element |
Syntax
Dictionary[int, string] bands;
bands.Add(1, "Queen");
bands.Add(2, "Children of Bodom");
bands.Add(3, "Blind Guardian");
bands.Add(4, "Sonata Arctica");
bands.Add(4, "Hammerfall"); // System.ArgumentException: An item with the same key has already been added.
OrderByValue()¶
Description
Sorts the elements of the Dictionary [K, S] in ascending order according to their values S
Return Type : Dictionary
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.Add(3, "Three");
dictionary.OrderByValue();
/*
Will be ordered like so:
dictionary.Add(1, "One");
dictionary.Add(3, "Three");
dictionary.Add(2, "Two");
*/
OrderByKey()¶
Description
Sorts the elements of the Dictionary [K, S] in ascending order according to their keys K
Return Type : Dictionary
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(3, "Three");
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.OrderByKey();
/*
Will be ordered like so:
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.Add(3, "Three");
*/
OrderByValueDescending()¶
Description
Sorts the elements of the Dictionary [K, S] in descending order according to their values S
Return Type : Dictionary
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(3, "Three");
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.OrderByValueDescending();
/*
Will be ordered like so:
dictionary.Add(2, "Two");
dictionary.Add(3, "Three");
dictionary.Add(1, "One");
*/
OrderByKeyDescending()¶
Description
Sorts the elements of the Dictionary [K, S] in descending order according to their keys K
Return Type : Dictionary
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(3, "Three");
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.OrderByKeyDescending();
/*
Will be ordered like so:
dictionary.Add(3, "Three");
dictionary.Add(2, "Two");
dictionary.Add(1, "One");
*/
GetKeys()¶
Description
Gets a collection containing all keys in the Dictionary [K, S]
Return Type : Collection
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.Add(3, "Three");
Collection[long] keys = dictionary.GetKeys(); //[1, 2, 3]
GetValues()¶
Description
Gets a collection containing all values in the Dictionary [K, S]
Return Type : Collection
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(1, "One");
dictionary.Add(2, "Two");
dictionary.Add(3, "Three");
Collection[string] values = dictionary.GetValues(); // ["One", "Two", "Three"]
Order(Func[K, S, int])¶
Description
Sorts the elements of the Dictionary [K, S] in ascending order according to specified Lambda
Return Type : Dictionary
Static : No
Namespace : StandardLibrary.Dictionary
Parameters
Name | Data Type | Description |
---|---|---|
lambdaExpression | Func | A Func containing the custom ordering code applied on each dictionary key and value pair. It must return an int value |
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(2, "Two");
dictionary.Add(1, "One");
dictionary.Add(3, "Three");
dictionary.Order(x, y => {
return x;
}); // "One", "Two", "Three"
Clear()¶
Description
Removes all keys and values from the Dictionary [K, S]
Return Type : void
Static : No
Namespace : StandardLibrary.Dictionary
Syntax
Dictionary[long, string] dictionary;
dictionary.Add(1, "One"); //Dictionary has one entry
dictionary.Clear(); //Dictionary is now empty
Remove(K)¶
Description
Removes a key-value element from the Dictionary [K, S], based on its key. If such a key does not exist, nothing is deleted
Return Type : void
Static : No
Namespace : StandardLibrary.Dictionary
Parameters
Name | Data Type | Description |
---|---|---|
key | K | The key, of type K, to be looked for |
Syntax
Dictionary[int, string] bands;
bands.Add(1, "Queen");
DebugLib.Logger.WriteInfoLine(bands.GetValues());
//{Queen}
bands.Add(2, "Children of Bodom");
DebugLib.Logger.WriteInfoLine(bands.GetValues());
{Queen, Children of Bodom}
bands.Remove(2);
DebugLib.Logger.WriteInfoLine(bands.GetValues());
//{Queen} - Removed the element with key 2
bands.Remove(2);
DebugLib.Logger.WriteInfoLine(bands.GetValues());
//{Queen} - Key 2 was already removed. Nothing bad happened tho..