/// <summary> /// Finishes construction of the object by populating properties of the object from /// the XML node /// </summary> /// <param name="theNode"></param> /// <param name="theManager">The manager.</param> public override void FinishConstruction(XElement theNode, DictionaryManager theManager) { XElement useNode = theNode.Element("Use"); Use = theManager.GetElementType(useNode.Value) as EnumDefinition; if (Use == null) { throw new DataDictionaryException("SwitchDefinition: {0} is not an enum type", useNode.Value); } m_SwitchCaseCollection = new SwitchCaseCollection(Use); // Note that each case node may have more than one value associated with it // Also a case node may have a nested type definition rather than a reference to a type var caseDefinitions = from caseNode in theNode.Elements("Case") from valueNode in caseNode.Elements("Value") select new SwitchCaseDefinition(caseNode, valueNode.Value, theManager); m_SwitchCaseCollection.AddRange(caseDefinitions); Name = theNode.Element("Name") != null ? theNode.Element("Name").Value : string.Format("switch_{0}", theManager.GetUniqueId()); }
public virtual ISwitchCaseCollection TransformSwitchCaseCollection(ISwitchCaseCollection value) { ISwitchCase[] array = new ISwitchCase[value.Count]; for (int i = 0; i < value.Count; i++) { array[i] = this.TransformSwitchCase(value[i]); } ISwitchCaseCollection target = new SwitchCaseCollection(); target.AddRange(array); return target; }