I have a three classes that are serialized into XML data via XMLserializer Method. Is there a way to make the method accessible by all of them rather than have three xmlserialize methods in my code.\[code\]//Here I'm writing to my class with the data that needs to be serialized SerializeSearch.PERSON r = new SerializeSearch.PERSON();SerializeSearch.REQUESTLOGIN ls = new SerializeSearch.REQUESTLOGIN();SerializeSearch.REQUESTLOGINSEARCHNBR ln = new SerializeSearch.REQUESTLOGINSEARCHNBR();ln.number = Convert.ToString(pnumber); r.SEARCH_QUERY = ln; string xml = doSerialization(r);//Call the xmlserializer method private static string doSerialization(SerializeSearch.PERSON r){ string serializedValue = http://stackoverflow.com/questions/14503127/string.Empty; try { XmlSerializer xmlSerializer = new XmlSerializer(r.GetType()); using (MemoryStream ms = new MemoryStream()) { xmlSerializer.Serialize(ms, r); ms.Position = 0; var sr = new StreamReader(ms); serializedValue = sr.ReadToEnd(); } serializedValue = serializedValue.Replace("version=\"0\"", string.Empty).Replace("<?xml version=\"1.0\"?>", string.Empty).Replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", string.Empty); serializedValue = http://stackoverflow.com/questions/14503127/serializedValue.Replace('\r', ' ').Replace('\n', ' ').Replace("<", "<").Replace(">", ">"); } return serializedValue;} \[/code\]My code repeats this two more time for two different classes, it writes to the class and then calls another xmlserialize method because the input of the method is a different class type. Is there are a way to make the method public or have as a class or any other way so that I don't have to paste two additional xmlserialize method that are exactly the same but the input class is different.