|
-
Mar 23rd, 2006, 11:30 PM
#1
Thread Starter
PowerPoster
InvalidOperationException?[Resolved]
hi. This is a wierd one
I have a class (several infact but lets take this one)
there is a method which serializes data of an object type. This method is used alot and works perfectly for this exception.
if my user wishes to delete an object from the UI, the UI confirms the user they wish to delete the object selected.
if so, the UI then calls this class to delete the object, given from the UI.
the method in this class does so, and serializes the object and does other stuff.
now, when it tries to serialize it, I get an invalidoperationexception but nothing in the innerException!
I have no idea what I am doing wrong. It is using the same method to serialize as it always does when sending data from this app to another over a network. Only difference being, the UI calling the method.
??
Code:
//Command Class:
public void DoDelete(MyClass someObject)
{
this.theSerializerClass.TheObject = someObject;
this.theSerializerClass.DoSerialize();
}
Serializer Class
Code:
public void DoSerialize()
{
if (this.theObject != null)
{
Type[] extraTypes = new Type[1];
extraTypes[0] = typeof(MyClass);
XmlSerializer theSerializer = new XmlSerializer(typeof(MyClass), extraTypes);
theSerializer.Serialize(this.theCommManager.TheNetworkStream, this.theObject);
}
}
and thats it.
the serializer class is always called upon, when creating a new object from user inputs, editing an object from user inputs etc.... but I always get this exception when I am trying to remove an object from an arraylist, but getting the specific instance out from the arraylist as the type of MyClass.
any ideas?
Last edited by Techno; Mar 23rd, 2006 at 11:36 PM.
-
Mar 23rd, 2006, 11:35 PM
#2
Thread Starter
PowerPoster
Re: InvalidOperationException?
disregard
had make a blank object and copy the existing object over to it - dont ask me why, think it was the way i was doing things
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|