| IGLib 1.4 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Member Functions | Public Attributes | Static Protected Attributes | Properties | Static Private Attributes

# IG::Lib::Util Class Reference

General utilities. More...

List of all members.

## Static Public Member Functions
static bool | MutexCheckAbandoned (Mutex m)
| Check whether the specified mutex has been abandoned, and returns true if it has been (otherwise, false is returned). After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.Call does not block.
static bool | MutexGlobalCheckAbandoned ()
| Check whether the global mutex (property MutexGlobal) has been abandoned, and returns true if it has been (otherwise, false is returned). After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.Call does not block.
static void | SleepSeconds (double sleepTimeInSeconds)
| Suspends execution of the current thread for the specified time (in seconds).
static int | GetHashFunctionInt (object obj)
| Returns an integer hash function of the specified object. Returned integer is always positive.This hash function is bound to the object.ToString method of the specified object, which means that it returns the same value for any two objects that have the same string representation.
static string | GetHashFunctionString (Object obj)
| Returns a string-valued hash function of the specified object. This hash function is bound to the object.ToString method of the specified object, which means that it returns the same value for any two objects that have the same string representation.
static int | GetIndex (int[] tableDimensions, params int[] indices)
| Returns the index of the element in the onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions.
static void | GetIndices (int[] tableDimensions, int oneDimensionalIndex, ref int[] tableIndices)
| Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index within 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower).
static int | GetIndex (List< int > tableDimensions, params int[] indices)
| Returns the index of the element in an onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions.
static void | GetIndices (List< int > tableDimensions, int oneDimensionalIndex, ref int[] tableIndices)
| Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index in the 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower).
static void | ResizeList< T > (ref List< T > list, int count, T defaultElement, bool reduceCapacity)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation.
static void | ResizeList< T > (ref List< T > list, int count, T defaultElement)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If new size is smaller than the original size of the list then its capacity is not reduced.
static void | ResizeListRefType< T > (ref List< T > list, int count, bool reduceCapacity)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type!
static void | ResizeListRefType< T > (ref List< T > list, int count)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type!
static void | CopyList< T > (List< T > original, ref List< T > target)
| Copies all elements of the specified list to a target list. After operation, target list contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target list can either be allocated (if it was allocated before the call) or not. Target list is allocated or re-allocated as necessary.
static void | CopyList< T > (List< T > original, ref T[] target)
| Copies all elements of the specified list to a target table. After operation, target table contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target table will also become null. Target table is allocated or re-allocated as necessary.
static bool | IsListSorted< T > (List< T > list, IComparer< T > comparer)
| Checks whether the specified list is sorted according to the specified comparer, and returns true if the list is sorted and false if it is not.
static void | InsertSortedList< T > (List< T > sortedList, T insertedElement, IComparer< T > comparer)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted. Duplicate elements are allowed.
static void | InsertSortedListUnique< T > (List< T > sortedList, T insertedElement, IComparer< T > comparer)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted. If the list already contains the element that is equal (in the sense of comparer) than the inserted element then this method has no effect.
static bool | IsListSorted< T > (List< T > list, Comparison< T > comparison)
| Checks whether the specified list is sorted according to the specified comparison function, and returns true if the list is sorted and false if it is not.
static int | BinarySearchSortedListFromTo< T > (List< T > sortedList, T searchedElement, int from, int to, Comparison< T > comparison)
| Searches a sorted list in the specified range for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binary complement of one greater than the last index if no element is greater).
static int | BinarySearchSortedList< T > (List< T > sortedList, T searchedElement, Comparison< T > comparison)
| Searches a sorted list for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binsry complement of number of elements if no element is greater).
static void | InsertSortedList< T > (List< T > sortedList, T insertedElement, Comparison< T > comparison)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted. Duplicate elements are allowed.
static void | InsertSortedListUnique< T > (List< T > sortedList, T insertedElement, Comparison< T > comparison)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted. If the list already contains the element that is equal (in the sense of comparer) than the inserted element then this method has no effect.
static string | CollectionToString (System.Collections.ICollection list, bool addNewlines, int numIndent)
| Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. Works on all collections, including lists and arrays.
static string | CollectionToString (System.Collections.ICollection list)
| Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. A newline and two spaces are added before each element printed. Works on all collections, including lists and arrays.
static string | CollectionToStringLong (System.Collections.ICollection collection, bool addNewlines, int numIndent)
| Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays.
static string | CollectionToStringLong (System.Collections.ICollection collection)
| Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays. A newline and two spaces are added before each element printed.
static string | ListToString< T > (List< T > list, bool addNewlines, int numIndent)
| Returns a string representing the specified generic list in short form (without count and capacity).
static string | ListToString< T > (List< T > list)
| Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed.
static string | ListToStringLong< T > (List< T > list, bool addNewlines, int numIndent)
| Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed.
static string | ListToStringLong< T > (List< T > list)
| Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed.
static bool | TryParseBoolean (string str, ref bool parsedValue)
| Tries to parse a string representation of a boolean.
static bool | ParseBoolean (string str)
| Converts the specified string to a boolean value, if possible, and returns it. If conversion is not possible then exception is thrown. Recognized representations of true: "true", "1", "yes", "y" (case insensitive). Recognized representations of false: "false", "0", "no", "n" (case insensitive).
static bool | TryParseThreadPriority (string str, ref ThreadPriority parsedValue)
| Tries to parse a string representation of a ThreadPriority enum.
static ThreadPriority | ParseThreadPriority (string str)
| Converts the specified string to a ThreadPriority enum value, if possible, and returns it. If conversion is not possible then exception is thrown. Recognized representations (not case sensitive):ThreadPriority.Lowest: "0", "lowest", "idle"ThreadPriority.BelowNormal: "1", "belownormal", "low"ThreadPriority.Normal: "2", "normal"ThreadPriority.AboveNormal: "3", "abovenormal", "high"ThreadPriority.: "4", "Highest", "realtime"
static void | ExampleList ()
## Public Attributes
const string | MutexGlobalName = "Global\\IG.Lib.Utils.MutexGlobal.R2D2_by_Igor_Gresovnik"
| Name of the global mutex.
const string | NullRepresentationString = "null"
| Standard string representation of null values of objects (often used when overriding object.ToString method).
const string | IGLibUrl = "http://www2.arnes.si/~ljc3m2/igor/iglib/"
const string | IGLibCodeDocumentationUrl = "http://www2.arnes.si/~fgreso/code_documentation/generated/iglib/html/index.html"
const string | IGLibAuthor = "Igor Grešovnik"
## Static Protected Attributes
static volatile Mutex | _mutexGlobal
## Properties
static object | LockGlobal`[get]`
| Global, process-level locking object. This object can be used for synchronization of any static methods.Warning: Do not use this lock for locking long lasting operations, since this can result in deadlocks.
static Mutex | MutexGlobal`[get]`
| Mutex for system-wide exclusive locks.
static int | OutputLevel`[get, set]`
| Serves as default output level for new objects of many classes that include the output level property (usually named "OutputLevel"). Such a property defines how much information about operation of the object is ouput to the console.
static internal int | MaxLengthIntToString`[get]`
| Returns maximal length of string representation of integer value of type int
## Static Private Attributes
static object | _lockGlobal = new object()
static volatile int | _outputLevel = 0
static volatile int | _maxLengthIntToString

## Detailed Description

General utilities.

$A Igor Apr10;

## Member Function Documentation

static bool IG::Lib::Util::MutexCheckAbandoned | ( | Mutex | m | ) | `[inline, static]`

Check whether the specified mutex has been abandoned, and returns true if it has been (otherwise, false is returned). After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.Call does not block.

Parameters:

  m | Mutex that is checked, must not be null.

Returns:
  true if mutex has been abandoned, false otherwise.

static bool IG::Lib::Util::MutexGlobalCheckAbandoned | ( |  | ) | `[inline, static]`

Check whether the global mutex (property MutexGlobal) has been abandoned, and returns true if it has been (otherwise, false is returned). After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.Call does not block.

Returns:
  true if mutex has been abandoned, false otherwise.

static void IG::Lib::Util::SleepSeconds | ( | double | sleepTimeInSeconds | ) | `[inline, static]`

Suspends execution of the current thread for the specified time (in seconds).

Parameters:

  sleepTimeInSeconds | Sleeping time in seconds. If less than 0 then thread sleeps indefinitely.

static int IG::Lib::Util::GetHashFunctionInt | ( | object | obj | ) | `[inline, static]`

Returns an integer hash function of the specified object. Returned integer is always positive.This hash function is bound to the object.ToString method of the specified object, which means that it returns the same value for any two objects that have the same string representation.

Parameters:

  obj | Object whose hash function is returned.

This hash function is calculated in such a way that object.ToString() is called first on obj in order to obtain object's string representation (or, if the object is null, the Util.NullRepresentationString is taken), and then the string.GetHashCode is called on the obtained string and its value returned.

static string IG::Lib::Util::GetHashFunctionString | ( | Object | obj | ) | `[inline, static]`

Returns a string-valued hash function of the specified object. This hash function is bound to the object.ToString method of the specified object, which means that it returns the same value for any two objects that have the same string representation.

Parameters:

  obj | Object whose string-valued hash function is returned.

This hash function is calculated in such a way that object.ToString() is called first on obj in order to obtain object's string representation (or, if the object is null, the Util.NullRepresentationString is taken), and then the string.GetHashCode is called on the obtained string and its value returned.

See also:
  Util.

static int IG::Lib::Util::GetIndex | ( | int[] | tableDimensions,
|  | params int[] | indices
| ) |  | `[inline, static]`

Returns the index of the element in the onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions.

Parameters:

  indices | Indices of the element in the multidimensional table of training results.
  tableDimensions | Dimensions of the multidimensional table.

Returns:
  One dimensional index that corresponds to the specified multidimensional indices of the element of the multidimensional table.

static void IG::Lib::Util::GetIndices | ( | int[] | tableDimensions,
|  | int | oneDimensionalIndex,
|  | ref int[] | tableIndices
| ) |  | `[inline, static]`

Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index within 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower).

Parameters:

  tableDimensions | Dimensions of the multidimensional table.
  oneDimensionalIndex | One dimensional index that defines the position of the element in the list of elements.
  tableIndices | Variable where multidimensional indices of the element are stored.

static int IG::Lib::Util::GetIndex | ( | List< int > | tableDimensions,
|  | params int[] | indices
| ) |  | `[inline, static]`

Returns the index of the element in an onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions.

Parameters:

  indices | Indices of the element in the multidimensional table of training results.
  tableDimensions | Dimensions of the multidimensional table.

Returns:
  One dimensional index that corresponds to the specified multidimensional indices of the element of the multidimensional table.

static void IG::Lib::Util::GetIndices | ( | List< int > | tableDimensions,
|  | int | oneDimensionalIndex,
|  | ref int[] | tableIndices
| ) |  | `[inline, static]`

Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index in the 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower).

Parameters:

  tableDimensions | Dimensions of the multidimensional table.
  oneDimensionalIndex | One dimensional index that defines the position of the element in the list of elements.
  tableIndices | Variable where multidimensional indices of the element are stored.

static void IG::Lib::Util::ResizeList< T > | ( | ref List< T > | list,
|  | int | count,
|  | T | defaultElement,
|  | bool | reduceCapacity
| ) |  | `[inline, static]`

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation.

Template Parameters:

  T | Type of the list element.

Parameters:

  list | List to be allocated.
  count | Number of elements list will contain after operation.
  defaultElement | Elements to be added to the list if there are currently too few elements.
  reduceCapacity | If true then capacity is reduced if the current list's capacity exceeds the specified number of elements.

$A Igor Apr10;

static void IG::Lib::Util::ResizeList< T > | ( | ref List< T > | list,
|  | int | count,
|  | T | defaultElement
| ) |  | `[inline, static]`

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If new size is smaller than the original size of the list then its capacity is not reduced.

Template Parameters:

  T | Type of the list element.

Parameters:

  list | List to be allocated.
  count | Number of elements list will contain after operation.
  defaultElement | Elements to be added to the list if there are currently too few elements.

$A Igor Apr10;

static void IG::Lib::Util::ResizeListRefType< T > | ( | ref List< T > | list,
|  | int | count,
|  | bool | reduceCapacity
| ) |  | `[inline, static]`

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type!

Template Parameters:

  T | Type of the list element, must be a reference type.

Parameters:

  list | List to be allocated.
  count | Number of elements list will contain after operation.
  reduceCapacity | If true then capacity is reduced if the current list's capacity exceeds the specified number of elements.

$A Igor Apr10;

Type Constraints

  T | : | class |

static void IG::Lib::Util::ResizeListRefType< T > | ( | ref List< T > | list,
|  | int | count
| ) |  | `[inline, static]`

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type!

Template Parameters:

  T | Type of the list element, must be a reference type.

Parameters:

  list | List to be allocated.
  count | Number of elements list will contain after operation.

capacity exceeds the specified number of elements.

$A Igor Apr10;

Type Constraints

  T | : | class |

static void IG::Lib::Util::CopyList< T > | ( | List< T > | original,
|  | ref List< T > | target
| ) |  | `[inline, static]`

Copies all elements of the specified list to a target list. After operation, target list contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target list can either be allocated (if it was allocated before the call) or not. Target list is allocated or re-allocated as necessary.

Template Parameters:

  T | Type of elements contained in the list.

Parameters:

  original | Original list.
  target | List that elements of the original list are copied to.

static void IG::Lib::Util::CopyList< T > | ( | List< T > | original,
|  | ref T[] | target
| ) |  | `[inline, static]`

Copies all elements of the specified list to a target table. After operation, target table contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target table will also become null. Target table is allocated or re-allocated as necessary.

Template Parameters:

  T | Type of elements contained in the list.

Parameters:

  original | Original list.
  target | Table that elements of the original list are copied to.

static bool IG::Lib::Util::IsListSorted< T > | ( | List< T > | list,
|  | IComparer< T > | comparer
| ) |  | `[inline, static]`

Checks whether the specified list is sorted according to the specified comparer, and returns true if the list is sorted and false if it is not.

Template Parameters:

  T | Type of elements of the list.

Parameters:

  list | List to be checked for sorting.
  comparer | Comparer according to which sorting is verified.

Returns:
  True if the specified list is sorted, false if not.

Exceptions:

  ArgumentNullException | If list or comparer is null.

static void IG::Lib::Util::InsertSortedList< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | IComparer< T > | comparer
| ) |  | `[inline, static]`

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted. Duplicate elements are allowed.

Template Parameters:

  T | Type of elements of the list.

Parameters:

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparer | Comparer according to which the list is sorted.

Exceptions:

  ArgumentNullException | If list or comparer is null.

static void IG::Lib::Util::InsertSortedListUnique< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | IComparer< T > | comparer
| ) |  | `[inline, static]`

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted. If the list already contains the element that is equal (in the sense of comparer) than the inserted element then this method has no effect.

Template Parameters:

  T | Type of elements of the list.

Parameters:

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparer | Comparer according to which the list is sorted.

Exceptions:

  ArgumentNullException | If list or comparer is null.

static bool IG::Lib::Util::IsListSorted< T > | ( | List< T > | list,
|  | Comparison< T > | comparison
| ) |  | `[inline, static]`

Checks whether the specified list is sorted according to the specified comparison function, and returns true if the list is sorted and false if it is not.

Template Parameters:

  T | Type of elements of the list.

Parameters:

  list | List to be checked for sorting.
  comparison | Comparison method (delegate) according to which sorting is verified.

Returns:
  True if the specified list is sorted, false if not.

Exceptions:

  ArgumentNullException | If list or comparer is null.

static int IG::Lib::Util::BinarySearchSortedListFromTo< T > | ( | List< T > | sortedList,
|  | T | searchedElement,
|  | int | from,
|  | int | to,
|  | Comparison< T > | comparison
| ) |  | `[inline, static]`

Searches a sorted list in the specified range for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binary complement of one greater than the last index if no element is greater).

Template Parameters:

  T | Type of list elements.

Parameters:

  sortedList | List that is searched for the element. List must be sorted according to the specified comparison function.
  searchedElement | Element that is searched for.
  from | Index of the first element in the searched range.
  to | Index of the last element in the searched range.
  comparison | Comparison function (delegate) according to which the list is sorted.

Returns:
  Index of the searched element in the list, if there exist an element (within the search range) that is equal to the search element according to the comparison delegate, or a binary complement of the negative index where the element should be inserted in order not tho spoil sorting.

Exceptions:

  ArgumentNullException | When list or comparison delegate is null.

static int IG::Lib::Util::BinarySearchSortedList< T > | ( | List< T > | sortedList,
|  | T | searchedElement,
|  | Comparison< T > | comparison
| ) |  | `[inline, static]`

Searches a sorted list for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binsry complement of number of elements if no element is greater).

Template Parameters:

  T | Type of list elements.

Parameters:

  sortedList | List that is searched for the element. List must be sorted according to the specified comparison function.
  searchedElement | Element that is searched for.
  from | Index of the first element in the searched range.
  to | Index of the last element in the searched range.
  comparison | Comparison function (delegate) according to which the list is sorted.

Returns:
  Index of the searched element in the list, if there exist an element (within the search range) that is equal to the search element according to the comparison delegate, or a binary complement of the negative index where the element should be inserted in order not tho spoil sorting.

Exceptions:

  ArgumentNullException | When list or comparison delegate is null.

static void IG::Lib::Util::InsertSortedList< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | Comparison< T > | comparison
| ) |  | `[inline, static]`

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted. Duplicate elements are allowed.

Template Parameters:

  T | Type of elements of the list.

Parameters:

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparison | Comparison function (delegate) according to which the list is sorted.

Exceptions:

  ArgumentNullException | If list or comparer is null.

static void IG::Lib::Util::InsertSortedListUnique< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | Comparison< T > | comparison
| ) |  | `[inline, static]`

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted. If the list already contains the element that is equal (in the sense of comparer) than the inserted element then this method has no effect.

Template Parameters:

  T | Type of elements of the list.

Parameters:

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparison | Comparison function (delegate) according to which the list is sorted.

Exceptions:

  ArgumentNullException | If list or comparer is null.

static string IG::Lib::Util::CollectionToString | ( | System.Collections.ICollection | list,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  | `[inline, static]`

Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. Works on all collections, including lists and arrays.

Parameters:

  list | Collection to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG::Lib::Util::CollectionToString | ( | System.Collections.ICollection | list | ) | `[inline, static]`

Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. A newline and two spaces are added before each element printed. Works on all collections, including lists and arrays.

Parameters:

  list | Collection to be converted to srting.

static string IG::Lib::Util::CollectionToStringLong | ( | System.Collections.ICollection | collection,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  | `[inline, static]`

Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays.

Template Parameters:

  T | Type of list elements.

Parameters:

  list | List to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG::Lib::Util::CollectionToStringLong | ( | System.Collections.ICollection | collection | ) | `[inline, static]`

Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays. A newline and two spaces are added before each element printed.

Template Parameters:

  T | Type of list elements.

Parameters:

  list | List to be converted to srting.

static string IG::Lib::Util::ListToString< T > | ( | List< T > | list,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  | `[inline, static]`

Returns a string representing the specified generic list in short form (without count and capacity).

Template Parameters:

  T | Type of list elements.

Parameters:

  list | List to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG::Lib::Util::ListToString< T > | ( | List< T > | list | ) | `[inline, static]`

Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed.

Template Parameters:

  T | Type of list elements.

Parameters:

  list | List to be converted to srting.

static string IG::Lib::Util::ListToStringLong< T > | ( | List< T > | list,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  | `[inline, static]`

Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed.

Template Parameters:

  T | Type of list elements.

Parameters:

  list | List to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG::Lib::Util::ListToStringLong< T > | ( | List< T > | list | ) | `[inline, static]`

Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed.

Template Parameters:

  T | Type of list elements.

Parameters:

  list | List to be converted to srting.

static bool IG::Lib::Util::TryParseBoolean | ( | string | str,
|  | ref bool | parsedValue
| ) |  | `[inline, static]`

Tries to parse a string representation of a boolean.

Parameters:

  str | String that is converted to boolean.
  parsedValue | Boolean value parsed from the specified string.

Returns:
  true if string was successfully converted to boolean, false if not (in this case parsedValue retains its previous value).

static bool IG::Lib::Util::ParseBoolean | ( | string | str | ) | `[inline, static]`

Converts the specified string to a boolean value, if possible, and returns it. If conversion is not possible then exception is thrown. Recognized representations of true: "true", "1", "yes", "y" (case insensitive). Recognized representations of false: "false", "0", "no", "n" (case insensitive).

Parameters:

  str | String representation of boolean to beparsed.

Returns:
  Boolean value represented by the specified string.

Exceptions:

  System.ArgumentNullException | When the string is null.
  System.FormatException | When the string can not represent a boolean value.

static bool IG::Lib::Util::TryParseThreadPriority | ( | string | str,
|  | ref ThreadPriority | parsedValue
| ) |  | `[inline, static]`

Tries to parse a string representation of a ThreadPriority enum.

Parameters:

  str | String that is converted to a ThreadPriority value.
  parsedValue | Boolean value parsed from the specified string.

Returns:
  true if string was successfully converted to ThreadPriority, false if not (in this case parsedValue retains its previous value).

See also:
  Util.ParseThreadPriority

static ThreadPriority IG::Lib::Util::ParseThreadPriority | ( | string | str | ) | `[inline, static]`

Converts the specified string to a ThreadPriority enum value, if possible, and returns it. If conversion is not possible then exception is thrown. Recognized representations (not case sensitive):ThreadPriority.Lowest: "0", "lowest", "idle"ThreadPriority.BelowNormal: "1", "belownormal", "low"ThreadPriority.Normal: "2", "normal"ThreadPriority.AboveNormal: "3", "abovenormal", "high"ThreadPriority.: "4", "Highest", "realtime"

Parameters:

  str | String representation of a ThreadPriority value to be parsed.

Returns:
  The ThreadPriority value represented by the specified string.

Exceptions:

  System.ArgumentNullException | When the string is null.
  System.FormatException | When the string can not represent a boolean value.

static void IG::Lib::Util::ExampleList | ( |  | ) | `[inline, static]`

## Member Data Documentation

object IG::Lib::Util::_lockGlobal = new object()`[static, private]`

const string IG::Lib::Util::MutexGlobalName = "Global\\IG.Lib.Utils.MutexGlobal.R2D2_by_Igor_Gresovnik"

Name of the global mutex.

volatile Mutex IG::Lib::Util::_mutexGlobal`[static, protected]`

volatile int IG::Lib::Util::_outputLevel = 0`[static, private]`

const string IG::Lib::Util::NullRepresentationString = "null"

Standard string representation of null values of objects (often used when overriding object.ToString method).

volatile int IG::Lib::Util::_maxLengthIntToString`[static, private]`

const string IG::Lib::Util::IGLibUrl = "http://www2.arnes.si/~ljc3m2/igor/iglib/"

const string IG::Lib::Util::IGLibCodeDocumentationUrl = "http://www2.arnes.si/~fgreso/code_documentation/generated/iglib/html/index.html"

const string IG::Lib::Util::IGLibAuthor = "Igor Grešovnik"

## Property Documentation

object IG::Lib::Util::LockGlobal`[static, get]`

Global, process-level locking object. This object can be used for synchronization of any static methods.Warning: Do not use this lock for locking long lasting operations, since this can result in deadlocks.

Mutex IG::Lib::Util::MutexGlobal`[static, get]`

Mutex for system-wide exclusive locks.

int IG::Lib::Util::OutputLevel`[static, get, set]`

Serves as default output level for new objects of many classes that include the output level property (usually named "OutputLevel"). Such a property defines how much information about operation of the object is ouput to the console.

General guidlines for use of the output level property in classes:

The property usually defineds the quantity of output produced by an object of a class that implements this property. It is not strictly prescribed what certain values of the property mean. By loose agreement, any negative value means unspecified output level (property not yet initialized), 0 means that no output is produced, 1 means only the most important information is ouptut and higher values mean that more detailed information about operation is output to the console.

For example application, see e.g. the IG.Gr.PlotterZedGraph in the 2D plotting library that uses IGLib.

internal int IG::Lib::Util::MaxLengthIntToString`[static, get, protected]`

Returns maximal length of string representation of integer value of type int

The documentation for this class was generated from the following file:

- Utils.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events