|
| static List< dynamic > | ConvertClassToList (dynamic myClass) |
| static Dictionary< object, dynamic > | ConvertClassToDictionary (dynamic myClass, string name="", HashSet< object > visited=null) |
| static dynamic | ConvertToClass (dynamic dictList, Type targetType, dynamic parentDictionary, List< string > columnNames) |
| static bool | IsBigIntegerType (Type type) |
| static bool | IsByteType (Type type) |
| static bool | IsBooleanType (Type type) |
| static bool | IsDateTimeType (Type type) |
| static bool | IsDateTimeOffsetType (Type type) |
| static bool | IsIpAddressType (Type type) |
| static bool | IsTimeSpanType (Type type) |
| static bool | IsGuidType (Type type) |
| static bool | IsVersionType (Type type) |
| static bool | IsEnumerableType (Type type) |
| static int | CountGraphNodes (object root, int limit, out bool cyclic) |
| | Walks an object graph far enough to answer two questions about it: is it big, and does it hold a cycle.
|
| static int | CountGraphNodes (object root, int limit) |
| | Counts nodes in an object graph, stopping at limit .
|
| static bool | IsEnumerableObject (dynamic dynamicObject) |
| static void | ConvertDictionaryToXmlElement (dynamic obj, XmlElement parent, bool emitWrapper=true, bool isTopLevel=true, HashSet< object > visited=null) |
| static void | ConvertHtmlDictionaryToXml (dynamic obj, XmlElement parent) |
| static string | ConvertDictionaryToHtml (Dictionary< object, dynamic > dictionary) |
| static List< Dictionary< object, dynamic > > | ConvertHtmlToDictionary (dynamic inputDataOrFilename, bool isChildren=false) |
| static HtmlNodeCollection | GetHtmlNodes (dynamic htmlorFilename) |
| static dynamic | CreateIEnumerableFromClass< T > (ConverterSettings converterSettings) |
| static List< T > | CreateListFromClass< T > (ConverterSettings converterSettings) |
| static dynamic | InstantiateOne (Type objectType, int arrayLength=0) |
| static bool | AddToList (dynamic listQueueStackDictHashsetOrArray, dynamic value, int count) |
| static Type | GetConcreteType (Type type) |
| static object | NormalizeForCleanJson (object input) |
| static object | StripGpalKeys (object input) |
| | Strips GPAL###_ prefixes and correctly handles repeated XML elements by turning sibling elements with the same name into proper lists — without extra nesting.
|
| static bool | TryConvertToWaitTime (object value, out WaitTime result) |
Definition at line 41 of file ConverterHelper.cs.
| int GenerallyPositive.ConverterHelper.CountGraphNodes |
( |
object | root, |
|
|
int | limit, |
|
|
out bool | cyclic ) |
|
static |
Walks an object graph far enough to answer two questions about it: is it big, and does it hold a cycle.
Both answers are wanted for the same decision, so the graph is walked once. The walk stops at limit nodes or at the first node it meets twice, whichever comes first, so its cost does not grow with the payload: a collection of forty thousand and one of four million cost the same.
A node already on the path back to the root is a cycle. Reference identity decides that, not Equals, because two equal nodes are not the same node and writing each of them out is correct.
Members are walked as well as collection items, since a cycle usually runs through a property rather than a list. What that would cost is kept down two ways: the members worth walking are worked out once per type and remembered, and a type whose members are all primitives, strings, dates, guids or decimals is never descended at all, because nothing made of those can take part in a cycle.
- Parameters
-
| root | The graph to walk |
| limit | Node count to stop at. Zero or less walks the whole graph, answering only cyclic |
| cyclic | Answers true when a node was met twice on one path |
- Returns
- Nodes counted, which reaches but never passes limit
Definition at line 2896 of file ConverterHelper.cs.