XML
- How to serialize an object to XML by using Visual C#
-
- Mark an class with the attribute [Serializable];
- XmlSerializer x = new XmlSerializer(SomeObject.GetType());
using (FileStream stream = System.IO.File.Create(FilePath))
{
XmlWriter writer = XmlWriter.Create(stream);
x.Serialize(writer, SomeObject);
}
- Deserializing XML to CLR object example
XmlSerializer x = new XmlSerializer(SomeObject.GetType());
using (FileStream fs = new FileStream(FilePath, FileMode.Open))
{
XmlReader reader = new XmlTextReader(fs);
SomeObject= (SomeObjectType) x.Deserialize(reader);
} - Serializing without the namespace (xmlns, xmlns:xsd, xmlns:xsi)
- How to bind XML to WPF controls.
- C# XML Serialization gotchas
Assembly
- How to merge two DLL assembly? The short answer: ILMerge.
- How to run the command “Regasm /codebase” for an installer project?
Visual Studio
Misc
- How to get the elapsed time?
DateTime oldDate = new DateTime(2002,7,15);
DateTime newDate = DateTime.Now;
TimeSpan ts = newDate – oldDate;
int differenceInDays = ts.TotalMilliseconds; - How to use Regular expressions (Regex)? Are there any examples?
- Custom Numeric Format Strings
WinForm