I'm fairly new to C# and while I'm able to work on existing code and make changes some things aren't very obvious to me. I'm currently doing a Pluralsight course on C# to further my knowledge.
What I've seen is that you can create a customised class of an existing class for your own use. I saw an implementation here where an overridden property for Encoding
was set. I'm working on a project where I need to create a lot of XML documents in various scenarios. I'd like to use the same settings for all and I'm hoping that it's possible to use my own class for this to avoid having to paste the same code many times over. The settings code I'd like to set when instantiating the class is below:
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = ("\t");
settings.OmitXmlDeclaration = true;
My aim is to create a custom class that would be instantiated like below but would have the above settings already set
CustomXmlWriterSettings settings = new CustomXmlWriterSettings();