/// <summary> /// Adds <see cref="Array1DPropertyObject"/> or <see cref="Array2DPropertyObject"/> /// Throws <see cref="NotSupportedException"/> if <see cref="System.Array"/> of <see cref="System.Array.Rank"/> greater than 2 is given /// </summary> /// <param name="name"></param> /// <param name="a"></param> /// <param name="propertyBuilder"></param> /// <returns></returns> public PropertyContainerBuilder Array(string name, Array a, Action <PropertyObjectBuilder> propertyBuilder = null) { if (config.ContainsData(name)) { DataContainerEvents.NotifyInformation($"Attempted to add invalid value : {name}"); return(this); } if (a.GetType().GetElementType().IsPrimitive == false) { throw new NotSupportedException("Arrays of non primitive types not supported"); } PropertyObject obj = null; if (a.Rank == 1) { obj = new Array1DPropertyObject(name, a); } else if (a.Rank == 2) { obj = new Array2DPropertyObject(name, a); } else { throw new NotSupportedException("Arrays of more than 2 dimensions not supported"); } propertyBuilder?.Invoke(new PropertyObjectBuilder(obj)); config.Add(obj); return(this); }
public PropertyObjectBuilder(PropertyObject obj) { prop = obj; }