473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Return IList with more data.

I'm trying to return a class that implements the IList interface and
has a few other data members as well.

// User Node class
[Serializable]
[XmlRootAttribute("User")]
public class User
{
private string m_username = "";
private string m_userpassword = "";
private string m_userDisplayName = "";

public User()
{
}

public User(string pUsername, string pUserpassword, string
pUserDisplayName)
{
m_username = pUsername;
m_userpassword = pUserpassword;
m_userDisplayName = pUserDisplayName;
}

[XmlElementAttribute(Type = typeof(string), IsNullable = false)]
public string UserName
{
get { return m_username; }
set { m_username = value; }
}

[XmlElementAttribute(Type = typeof(string), IsNullable = false)]
public string UserDisplayName
{
get { return m_userDisplayName; }
set { m_userDisplayName = value; }
}

[XmlElementAttribute(Type = typeof(string), IsNullable = false)]
public string UserPassword
{
get { return m_userpassword; }
set { m_userpassword = value; }
}
}

// UserList class
[Serializable]
[XmlRootAttribute("UserList")]
public class UserList : ReturnSet, IList<User>
{
// IList members

[XmlArrayAttribute("Users")]
[XmlArrayItemAttribute("User", typeof(User))]
public User[] Users
{
get { return (User[])m_list.ToArray(typeof(User)); }
set
{
m_list = new ArrayList(value);
}
}

private bool m_lockdownHandheld = false;
private bool m_deleteAllData = false;

[XmlElementAttribute("Lockdown")]
public bool Lockdown
{
get { return m_lockdown; }
set { m_lockdown = value; }
}

[XmlElementAttribute("DeleteAllData")]
public bool DeleteAllData
{
get { return m_deleteAllData; }
set { m_deleteAllData = value; }
}
}

What I expect to get back when the web service call is made is an XML
similar to the following:

<UserList xmlns...>
<Lockdown>False</Lockdown>
<DeleteAllData>False</DeleteAllData>
<Users>
<User>
<UserName>Rob</UserName>
<UserPassword>12345</UserPassword>
<UserDisplayName>Rob Smith</UserDisplayName>
<User>
<User>....</User>
</Users>
</UserList>

What I am seeing instead is the following:

<UserList xmlns...>
<User>
<UserName>Rob</UserName>
<UserPassword>12345</UserPassword>
<UserDisplayName>Rob Smith</UserDisplayName>
</User>
<User>....</User>
</UserList>

The Lockdown and DeleteAllData properties of the UserList class are
being ignored.

I'm trying to return a list of Users (Or whatever data object) and
some control data to a client application. (i.e. Lockdown = True take
some action to disable the client software) Is there anyway to
accomplish what I am trying to do here?

Thanks for your help.

-Rob-
Oct 22 '08 #1
1 1266
Solved my own problem. Turns out by implementing IList ASP treated it
as a list only. I created a wrapper class that contained my two
properties and a List and all is working fine now.

Thanks for any consideration.

-Rob-
Oct 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: emma middlebrook | last post by:
Hi Straight to the point - I don't understand why System.Array derives from IList (given the methods/properties actually on IList). When designing an interface you specify a contract. Deriving...
3
by: Chris | last post by:
Hi, the specs for System.Array are : public abstract class Array : ICloneable, IList, ICollection, IEnumerable but I can't use any of the functions presented by IList in my code ...
13
by: cody | last post by:
why arent there some util functions for IList for example Sort()? -- cody Freeware Tools, Games and Humour http://www.deutronium.de.vu || http://www.deutronium.tk
3
by: ad | last post by:
Hi, When I studied CSharp, I am confuse by IList, Collection and Array. What is the relationships between them?
1
by: Ldraw | last post by:
I am returning an IList from a WebService Function that contains a custom Class. The class contains ID and Name properties. I can see these in the IList when the data is returned. I tried to use...
4
by: Rene | last post by:
According to the documentation, the List<T> type explicitly implements the non generic IList interface. The problem is that no matter how hard I look, I am not able to find this implemetion on...
6
by: miked | last post by:
Why are there still no covariant return types? All searches reveal no workarounds accept for using an interface which is a real pain. I wind up missing this capability almost every time I...
2
by: Veloz | last post by:
Hi there My question is regarding how to best return "collections" from a method call. Should you return an actual object or an interesting/ appropriate interface of the object, to the caller?...
6
by: huohaodian | last post by:
Hi I have some code something like. public class Info { public static IList GetUser() { return User.GetUser();} } internal class User
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.