/// <summary> /// Constructs a new instance of UltimaPacketPropertyValue and /// gets property value. /// </summary> /// <param name="definition">Property defintion.</param> /// <param name="owner">Proeprty owner.</param> public UltimaPacketPropertyValue( UltimaPacketPropertyDefinition definition, UltimaPacketValue owner ) { _Definition = definition; _Owner = owner; // Get value object value = definition.Getter( owner.Object ); if ( definition is UltimaPacketListPropertyDefinition ) { List<UltimaPacketValue> objects = new List<UltimaPacketValue>(); UltimaPacketListPropertyDefinition list = (UltimaPacketListPropertyDefinition) definition; IEnumerable e = value as IEnumerable; if ( e != null ) { foreach ( object o in e ) objects.Add( new UltimaPacketValue( list.ChildDefinition, o ) ); } _Value = objects; } else _Value = value; }
/// <summary> /// Constructs a new instance of UltimaPacketPropertyValue and /// gets property value. /// </summary> /// <param name="definition">Property defintion.</param> /// <param name="owner">Proeprty owner.</param> public UltimaPacketPropertyValue(UltimaPacketPropertyDefinition definition, UltimaPacketValue owner) { _Definition = definition; _Owner = owner; // Get value object value = definition.Getter(owner.Object); if (definition is UltimaPacketListPropertyDefinition) { List <UltimaPacketValue> objects = new List <UltimaPacketValue>(); UltimaPacketListPropertyDefinition list = (UltimaPacketListPropertyDefinition)definition; IEnumerable e = value as IEnumerable; if (e != null) { foreach (object o in e) { objects.Add(new UltimaPacketValue(list.ChildDefinition, o)); } } _Value = objects; } else { _Value = value; } }