private Col1 GetConstructorProperties(int nr) { string GetExpressionPlus() { switch (Cfg.TypeName) { case "AreaUnit": return(@"?.Replace('2', '²')"); case "VolumeUnit": return(@"?.Replace('3', '³')"); default: return(null); } } var expr = PropertyName.FirstLower() + GetExpressionPlus(); if (nr == 1) { if (Related is null || !Related.IsPower2OrHigher) { return(null); } var a = new[] { new ConstructorParameterInfo("BaseUnit", Related.MyInfo.PowerOne.Unit.TypeName, null, "based on", Flags1.NotNull, property => { property.AddRelatedUnitSourceAttribute(Target, RelatedUnitSourceUsage.DoNotUse, 0); }), new ConstructorParameterInfo(PropertyName, "string", expr, "name of unit", Flags1.Optional | Flags1.DoNotAssignProperty | Flags1.DoNotCreateProperty) }; var h = new Col1(a); var powerChar = Ext.GetPowerSuffix(Related.MyInfo.Power); h.Writer2.WriteLine("unitName = unitName?.Trim();"); h.Writer2.WriteLine(PropertyName + " = string.IsNullOrEmpty(unitName) ? baseUnit.UnitName + " + powerChar.CsEncode() + " : unitName;"); return(h); } { var b = new[] { new ConstructorParameterInfo(PropertyName, "string", expr, "name of unit", Flags1.NormalizedString) }; return(new Col1(b)); } }