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;}}
}
}
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;}}
}
}