public static string GetRestOfXMLTag(WixObject obj) { Type type = obj.GetType(); List <PropertyInfo> properties = type.GetProperties().ToList(); StringBuilder sb = new StringBuilder(); PropertyInfo idP = null; foreach (PropertyInfo p in properties) { if (p.Name == "Id") { idP = p; } } properties.Remove(idP); properties.Insert(0, idP); foreach (PropertyInfo property in properties) { object value = property.GetValue(obj, null); if (value != null) { bool skip = false; if (value is string strVal) { if (strVal.IsNullOrWhitespace()) { skip = true; } } //if(!skip) sb.Append(property.Name + "=\"" + value + "\" "); } } sb.Append(">"); return(sb.ToString()); }
public void AddObj(WixObject obj) { this.Objects.Add(obj); }