Click here to Skip to main content
15,907,392 members
Home / Discussions / C#
   

C#

 
AnswerRe: SQL SCRIPT Pin
Henry Minute22-Apr-09 5:13
Henry Minute22-Apr-09 5:13 
GeneralRe: SQL SCRIPT Pin
kibromg22-Apr-09 5:23
kibromg22-Apr-09 5:23 
GeneralRe: SQL SCRIPT Pin
Dave Kreskowiak22-Apr-09 6:49
mveDave Kreskowiak22-Apr-09 6:49 
GeneralRe: SQL SCRIPT Pin
Henry Minute22-Apr-09 7:49
Henry Minute22-Apr-09 7:49 
AnswerRe: SQL SCRIPT Pin
PauloCastilho22-Apr-09 8:20
PauloCastilho22-Apr-09 8:20 
QuestionParsing incoming DateTime in C# WebService myself? Pin
Thomas ST22-Apr-09 4:39
Thomas ST22-Apr-09 4:39 
AnswerRe: Parsing incoming DateTime in C# WebService myself? Pin
student_rhr22-Apr-09 7:57
student_rhr22-Apr-09 7:57 
QuestionHow to make a column of listview control invisible Pin
NarVish22-Apr-09 4:30
NarVish22-Apr-09 4:30 
AnswerRe: How to make a column of listview control invisible Pin
Eddy Vluggen22-Apr-09 4:55
professionalEddy Vluggen22-Apr-09 4:55 
Questionhelp Pin
benson.misi22-Apr-09 4:28
benson.misi22-Apr-09 4:28 
AnswerRe: help Pin
musefan22-Apr-09 4:35
musefan22-Apr-09 4:35 
AnswerRe: help Pin
SeMartens22-Apr-09 4:39
SeMartens22-Apr-09 4:39 
AnswerRe: help Pin
CPallini22-Apr-09 4:41
mveCPallini22-Apr-09 4:41 
AnswerRe: help Pin
Thomas ST22-Apr-09 4:45
Thomas ST22-Apr-09 4:45 
QuestionObject "type not expected" when using serialization in web services Pin
BASONJS22-Apr-09 4:03
BASONJS22-Apr-09 4:03 
AnswerRe: Object "type not expected" when using serialization in web services Pin
Thomas ST22-Apr-09 4:59
Thomas ST22-Apr-09 4:59 
GeneralRe: Object "type not expected" when using serialization in web services Pin
BASONJS22-Apr-09 5:14
BASONJS22-Apr-09 5:14 
GeneralRe: Object "type not expected" when using serialization in web services Pin
Thomas ST22-Apr-09 20:57
Thomas ST22-Apr-09 20:57 
System.Runtime.Serialization is used for binary serialization.
Since Webservices use Soap wich is xml, you should serialize objects to xml.

Read this article on msdn about XML Serialization with XML Web Services.

In your example, just import System.Xml.Serialization and add the annotation [System.Xml.Serialization.XmlTypeAttribute()].
And make public accessors to the members you want to be serialized.

using System;
using System.Runtime.Serialization;
using Person;
using System.Xml;
using System.Xml.Serialization;

namespace SchoolPackage
{
    //This line is basically all you need for the class to be serializable
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.x.com/namespace/", TypeName = "Student")]
    public class Student
    {
        [System.Xml.Serialization.XmlElementAttribute(ElementName = "myCustomXmlElementName")]
        public string StrLastAlteredByUser
        {
            get { return strLastAlteredByUser; }
            set { strLastAlteredByUser = value; }
        }
    }
}


ps. personally I would let Student inherit Person Smile | :)
GeneralRe: Object "type not expected" when using serialization in web services Pin
BASONJS22-Apr-09 23:04
BASONJS22-Apr-09 23:04 
GeneralRe: Object "type not expected" when using serialization in web services Pin
BASONJS23-Apr-09 5:29
BASONJS23-Apr-09 5:29 
Questionproblem with keypress function Pin
MehmetKocc22-Apr-09 3:57
MehmetKocc22-Apr-09 3:57 
AnswerRe: problem with keypress function Pin
musefan22-Apr-09 4:02
musefan22-Apr-09 4:02 
AnswerRe: problem with keypress function Pin
Luc Pattyn22-Apr-09 4:13
sitebuilderLuc Pattyn22-Apr-09 4:13 
AnswerRe: problem with keypress function Pin
DoctorMick22-Apr-09 4:15
DoctorMick22-Apr-09 4:15 
AnswerRe: problem with keypress function Pin
ramz_g22-Apr-09 23:22
ramz_g22-Apr-09 23:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.