Re: Property Fields in .Net Classes... ANOTHER Compile Error-"XML-SERIALIZABLE&q
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server Orchestration > Re: Property Fields in .Net Classes... ANOTHER Compile Error-"XML-SERIALIZABLE&q




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Property Fields in .Net Classes... ANOTHER Compile Error-"XML-SERIALIZABLE&q  
Hong Lee


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-01-04 01:49 AM

I added a default constructor.
(Here is my class...)

[Serializable]
public class POClass {
[Property(typeof(PropertySchemas.IDs))]
public string ID;

public string Item;
public POClass() { }
}


Still...
a compile error "a class must have a default constructor to be serialized by
mlSerializer" reported.


I think...

Although there is no default constructor specified in class definition...
default constructor is provided implicitly when there is no any other
constructors.

so...
"a class must have a default constructor to be serialized by XmlSerializer"
means...a class should not be like this...
public class POClass {
[Property(typeof(PropertySchemas.IDs))]
public string ID;

public string Item;
public POClass(string s) { ID = s; }
}


So...
I solved the xml-serializable problem
by adding an attribute that control XML serialization....


[Serializable]
public class POClass
{
[Property(typeof(PropertySchemas.IDs))]
[XmlRootAttribute("PO")]
public string ID;

public string Item;
}

I feel...
this is not the right way to solve the compile error.

Plz...
comment me more...







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:17 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register