Note: [Deprecated Content] This was written while ASP.NET and .NET Core was in beta (around beta5 or beta6). Since then a lot of stuffs have changed and moved around. Stuffs described below may or may not be true for current stable releases of ASP.NET Core - Configuration feature. I recommend not to follow along and get confused. Use official configuration documentation that explains it correctly - docs.asp.net With the upcoming release of .NET 4.6 and ASP.NET 5 (currently in BETA phase) one namespace that is getting new look (re-written) is System.Configuration. If you have not already read then I recommend you to take a look at getting started post by Louis DeJardin - ASP.NET vNext Moving Parts: IConfiguration He has also explained other moving parts which are some interesting reads. Why you ask? Louis explains few reason why System.Configuration needs to » Read more

 Jsinh        

In case you are serializing your models to generate XML content, you will often encounter empty nodes and elements in the XML which appears when the entity property is not filled or the list is empty. Lets take an example of Employee model class as below: using System.Collections.Generic; using System.Xml.Serialization; public class Employee { public Employee() { this.Skills = new List&lt;string&gt;(); } [XmlElement("FirstName")] public string FirstName { get; set; } [XmlElement("LastName")] public string LastName { get; set; } [XmlArray("Skills")] [XmlArrayItem("Skill")] public List<string> Skills { get; set; } } When you generate XML for the above model by assigning FirstName and LastName only keeping Skills empty: var employeeDetail = new Employee() { FirstName = "Mister", LastName = "XYZ" }; var employeeDetailXml = SerializeXml(employeeDetail); you will get XML content something like this: <?xml version="1.0" » Read more

 Jsinh        

All .NET string is in Unicode (UTF-16) encoding format. So when you are using StringWriter to create your XML it will use UTF-16 encoding. Example when creating XML : var serializer = new XmlSerializer(yourModel.GetType(), string.Empty); var stringBuilder = new StringBuilder(); using (var stringWriter = new StringWriter()) { serializer.Serialize(stringWriter, yourModel); stringBuilder.Append(stringWriter); } var resultString = stringBuilder.ToString(); But you want your XML to use UTF-8 encoding. One good way of doing this is to derive the StringWriter class and override the encoding. using System.IO; using System.Text; public sealed class ExtentedStringWriter : StringWriter { private readonly Encoding stringWriterEncoding; public ExtentedStringWriter(StringBuilder builder, Encoding desiredEncoding) : base(builder) { this.stringWriterEncoding = desiredEncoding; } public override Encoding Encoding { get { return this.stringWriterEncoding; } } } Then you can use ExtendedStringWriter instead of StringWriter in the above example. » Read more

 Jsinh