/// <summary> /// Sets the value of a dynamic content object, creating a new one if needed /// </summary> /// <param name="Name">The name of the object</param> /// <param name="Value">The value to set</param> /// <param name="Type">The type of dynamic content object to create (if creatable)</param> public static void Set(string Name, object Value, DynamicContentObjectType Type = DynamicContentObjectType.Common) { if (Values.ContainsKey(Name)) { Values[Name].Value = Value; } else { switch (Type) { case DynamicContentObjectType.Dictionary: Values[Name] = new DynamicContentDictionary(Name, Value); break; case DynamicContentObjectType.List: Values[Name] = new DynamicContentList(Name, Value); break; case DynamicContentObjectType.Queue: Values[Name] = new DynamicContentQueue(Name, Value); break; case DynamicContentObjectType.Stack: Values[Name] = new DynamicContentStack(Name, Value); break; default: Values[Name] = new DynamicContentObject(Name, Value); break; } } }
/// <summary> /// Returns the Dynamic Content Object under the specified name /// </summary> /// <param name="Name">The name of the object to return</param> /// <returns>The Dynamic Content Object selected</returns> public static DynamicContentObject Get(string Name) { if (!Values.ContainsKey(Name)) { Values[Name] = new DynamicContentObject(Name, null); } return(Values[Name]); }
/// <summary> /// Sets the value of a dynamic content object, creating a new one if needed /// </summary> /// <param name="Name">The name of the object</param> /// <param name="Value">The value to set</param> public static void Set(string Name, object Value) { string low = Name.ToLower(); if (Values.ContainsKey(low)) { Values[low].Value = Value; } else { Values[low] = new DynamicContentObject(low, Value); } }