public static Unit GetWidth(Unit width, double totalWeight) { if(width.Type == UnitType.None) { if(totalWeight == 0) return Unit.Parse("100%"); else return Unit.Parse(string.Format("{0}%", Math.Round(width.Value / totalWeight * 100, 4))); } return width; }
public static bool IsEmpty(Unit value) { return (value.Value == 0d); }