Returning my object(s) from web service

T

Toby Mathews

Hi there

I am trying to return an instance of a class from a web service that
contains a collection of instances of another class. I have three classes:

Person
MyEmails
MyEmail

Person is the 'base' class, which may contain an instance of
'MyEmails',which is essentially a collection of instances of 'MyEmail.' In
the code calling the web method the instance of the 'Person' class returned
is populated correctly, except that the properties/methods of my 'MyEmails'
class cannot be accessed. I just see the generic methods (ToString, Equals
etc). Am I missing something obvious?

The code for the file containing the three classes (in simplified form)
follow - thanks in advance if anyone can help.


using System;
using System.Collections;

namespace Test.WebService
{
public class Person
{
private Test.WebService.MyEmails memEmails = new
Test.WebService.MyEmails();

public Test.WebService.MyEmails Emails {get {return memEmails;}set
{memEmails = value;}}

public Person()
{
}
}

public class MyEmails
{
ArrayList marEmails = new ArrayList();

public MyEmails()
{
}

public MyEmail this[int index]
{
get
{
Test.WebService.MyEmail remTmp = marEmails[index] as
Test.WebService.MyEmail;
return remTmp;
}
}

public void Add(string Email)
{
Test.WebService.MyEmail remTmp = new Test.WebService.MyEmail(Email);
marEmails.Add(remTmp);
}

public void Clear() {marEmails.Clear();}
public int Count {get {return marEmails.Count;}}
}

public class MyEmail
{
private string msEmail = "";

public MyEmail()
{
}

public MyEmail(string Email)
{
msEmail = Email;
}

public string Email {get {return msEmail;} set {msEmail = value;}}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top