I am doing something very similar. In fact, my code is almost verbatim of what he had there from your link.
However, I was just wanting to use the generic methods that I wrote to deserialize or serialize. Regardless, I'm revising the methods to use the this.GetType() method to return the actual reflected type; I'm at a loss to figure out how to pass a computed type to Thanks, Mike On 9/6/06, Ernst Kuschke <[EMAIL PROTECTED]> wrote:
Hi Mike, Why don't you inspect the type of the parameter passed inside of GetSerializedXml? Something like this: http://dotnet.org.za/ernst/archive/2006/07/31/Serializing_2D00_-and-Deserializing-objects-in-.net.aspx -- Ernst Kuschke MVP - C# (South Africa) http://dotnet.org.za/ernst On 9/6/06, Mike Andrews <[EMAIL PROTECTED]> wrote: > > Guys, > > I have a problem that I need some help with. > I have two generic methods that will Serialize/Deserialize an object to > and > from it's xml equivalent. > > However, I'd like to write a method in my base class that will "serialize" > "myself." However, I can't determine a way to pass the "Type that I am" > in > the the generic type parameter. > > Here's an example of how I'm serializing and deserializing the object: > > Person p = New Person(); > string xml = Serialization.GetSerializedXml<Person>(p); > > ... > > Person p = null; > p = Serialization.GetDeserializedXml<Person>(xml); > > > How can I do something similar to this: > > public class BaseClass{ > ... > public string Serialize(){ > > //This will not work > return Serialization.GetSerializedXml<typeof(this)>(this); > > } > > } > > Thank you for any help or assistance, > Mike > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
=================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com