.NET

All .NET related posts








Should I call EnsureChildControls in code? It depends on different scenarios. Actually, EnsureChildControls method determines whether the server control contains child controls. If it does not, it creates child controls. This method first checks the current value of the ChildControlsCreated property. If this value is false, the CreateChildControls method is […]

When to call EnsureChildControls in custom controls








The XmlSerializer can cause serious problems in multithreaded environments. See this piece of code. [ThreadStatic] private static XmlSerializer xmlSerializer = new XmlSerializer(typeof(Mailpack), Namespace); private static string SerialiseAssemblageResultaat(Mailpack mailpack) { StringBuilder xmlString = new StringBuilder(); TextWriter xmlWriter = new StringWriter(xmlString); try { xmlSerializer.Serialize(xmlWriter, mailpack); return xmlString.ToString(); } finally { xmlWriter.Close(); xmlWriter.Dispose(); […]

Using the XmlSerializer in multithreaded applications