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Ā®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to