Friday

remove namespace xml in serialisation by XmlSerializerNamespaces.dot.net/C#/csharp


 public static string toXML(Object obj)
{
XmlSerializer xmlSerializer = new XmlSerializer(obj.GetType());
StringWriter stringWriter = new StringWriter();
XmlWriterSettings writerSettings = new XmlWriterSettings();
writerSettings.OmitXmlDeclaration = true;
writerSettings.Indent = true;


using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter, writerSettings))
{

// Namespace removed in these two lines:
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");


xmlSerializer.Serialize(xmlWriter, obj,ns);

}
return stringWriter.ToString();
}

more...

1 comment:

Anonymous said...

mil thks era presisamente o que estaba buscando!!!!

excelente!!!!!

here is powershell script on how to get list of files from changesets associated with one tfs task

$dllPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\...