[ROOT] / doc / toc / ARCCore / Class / Extensions
AddValue , ForEach , GetValue , KeysAsString , Result , Single , SingleOrDefault , ToStringDateAndTime , ToStringDB , ToStringShort , ToStringVeryShort , ToStringWithMS , Use
Contains a few general nice to have extensions methods.
TODO: If this class accumulates too many methods, consider splitting it into multiple classes in a separate folder.
TODO: For instance a TypeExtensions class and DictionaryExtensions class would be natural.
TODO: (together with maybe a StringExtensionClass).
NOTE: Message to developers. Think through before you decide on adding anything to this class. It should really be kept as small as possible.
NOTE: Often a utility method in a related class is good enough.
See also UtilCore.
| AddValue | Gives better error messages compared to 'original' Add when adding a value to a directory if key already exists |
| ForEach | Useful when we want to write collection.ForEach( ... ) instead of |
| GetValue | Gives better error messages when reading value from directory if key does not exist |
| KeysAsString | Gives a compressed overview of keys in a dictionary. Helpful for building exception messages. |
| Result | Returns heading plus return-value of function (calls function). If function == null then empty string is returned |
| Single | Same as inbuilt LINQ's Single except that gives a more friendly exception message |
| SingleOrDefault | Same as inbuilt LINQ's SingleOrDefault except that gives a more friendly exception message |
| ToStringDateAndTime | Uses format 'yyyy-MM-dd HH:mm:ss.fff'. |
| ToStringDB | Gives the minimum representation of type as string suitable for later reconstruction by GetType. |
| ToStringShort | Returns a shorter representation than ToStringDB. |
| ToStringVeryShort | Returns same as ToStringShort but without any generics information at all. |
| ToStringWithMS | Uses either format 'd\.hh\:mm\:ss\.fff' or 'hh\:mm\:ss\.fff' depending on TotalHours >=24 hours or not. |
| Use | Convenience method that shortens down code in cases where an instance of an object must be created first in order to use that same variable multiple times |
Generated 2025-10-28 18:34:26.797 UTC