Example #1
0
		/// <summary>
		/// Gets an array of dimensions of the DataSet.
		/// </summary>
		/// <returns>An array of <see cref="Dimension"/>.</returns>
		/// <remarks>
		/// If the schema corresponds to the proposed version of the DataSet and
		/// some dimension differs for different variables, in the returning array the dimension
		/// has length equal to <c>-1</c>.
		/// </remarks>
		public Dimension[] GetDimensions()
		{
			if (vars == null || vars.Length == 0) return new Dimension[0];

			Dictionary<string, Dimension> dims = new Dictionary<string, Dimension>();
			foreach (var v in vars)
				foreach (var vd in v.Dimensions)
				{
					Dimension dim;
					if (dims.TryGetValue(vd.Name, out dim))
						dim.Length = -1;
					else
						dim = vd;
					dims[vd.Name] = vd;
				}
			Dimension[] dimsArr = new Dimension[dims.Count];
			dims.Values.CopyTo(dimsArr, 0);
			return dimsArr;
		}