Click here to Skip to main content
15,917,061 members
Home / Discussions / C#
   

C#

 
GeneralRe: RegEx Question Pin
OriginalGriff26-Jan-11 8:25
mveOriginalGriff26-Jan-11 8:25 
GeneralRe: RegEx Question Pin
TheGreatAndPowerfulOz26-Jan-11 8:32
TheGreatAndPowerfulOz26-Jan-11 8:32 
GeneralRe: RegEx Question Pin
AspDotNetDev26-Jan-11 9:31
protectorAspDotNetDev26-Jan-11 9:31 
GeneralRe: RegEx Question Pin
TheGreatAndPowerfulOz26-Jan-11 9:59
TheGreatAndPowerfulOz26-Jan-11 9:59 
GeneralRe: RegEx Question Pin
RobCroll26-Jan-11 12:55
RobCroll26-Jan-11 12:55 
QuestionReserve memory in Collection Pin
hairy_hats26-Jan-11 5:58
hairy_hats26-Jan-11 5:58 
AnswerRe: Reserve memory in Collection Pin
Yusuf26-Jan-11 6:43
Yusuf26-Jan-11 6:43 
AnswerRe: Reserve memory in Collection Pin
Luc Pattyn26-Jan-11 7:23
sitebuilderLuc Pattyn26-Jan-11 7:23 
GeneralRe: Reserve memory in Collection Pin
hairy_hats27-Jan-11 5:43
hairy_hats27-Jan-11 5:43 
GeneralRe: Reserve memory in Collection Pin
Luc Pattyn27-Jan-11 5:49
sitebuilderLuc Pattyn27-Jan-11 5:49 
AnswerRe: Reserve memory in Collection Pin
DaveyM6926-Jan-11 8:26
professionalDaveyM6926-Jan-11 8:26 
AnswerRe: Reserve memory in Collection Pin
Luc Pattyn26-Jan-11 8:56
sitebuilderLuc Pattyn26-Jan-11 8:56 
GeneralRe: Reserve memory in Collection Pin
AspDotNetDev26-Jan-11 9:35
protectorAspDotNetDev26-Jan-11 9:35 
AnswerRe: Reserve memory in Collection Pin
AspDotNetDev26-Jan-11 9:41
protectorAspDotNetDev26-Jan-11 9:41 
QuestionGenerate from PDF images with iTextSharp? Pin
BoySetsFire26-Jan-11 5:56
BoySetsFire26-Jan-11 5:56 
AnswerRe: Generate from PDF images with iTextSharp? Pin
Yusuf26-Jan-11 6:47
Yusuf26-Jan-11 6:47 
GeneralRe: Generate from PDF images with iTextSharp? Pin
BoySetsFire26-Jan-11 8:29
BoySetsFire26-Jan-11 8:29 
GeneralRe: Generate from PDF images with iTextSharp? Pin
Yusuf26-Jan-11 8:50
Yusuf26-Jan-11 8:50 
QuestionHaving trouble with network account removal on local machine Pin
turbosupramk326-Jan-11 5:11
turbosupramk326-Jan-11 5:11 
QuestionReturn List<> frrom WebMethod Pin
huge_superman26-Jan-11 3:45
huge_superman26-Jan-11 3:45 
Hi Guys,

Wondering if you can help me figure this out.
Here is an Example:

I have a class:
---------------
This class exist in my web service as well as my test windows appication.

public class ADUser
{
private string _name;
private string _surname;

public string Name{get {return _name;}set {_name = value;}}
public string Surname{get {return _surname;}set {_surname = value;}}
}


Here is an example of my Web Service and WebMethod:
---------------------------------------------------
List<ADUser> mylist = new List<AdUser>();
AdUser user = null;
//The method populates users from active directory into a list
private void PopulateList()
{
foreach (User in active directory)
{
user = new AdUser();
user.Name = "displayName";
user.Surname = "lastname";
mylist.Add(user);
}
}

[WebMethod]
public List<ADUser> GetUserList()
{
PopulateList();
return mylist;
}

This is my Desktop Application
------------------------------

WebService1 ws = new WebService();
List<ADUser> list = new List<ADUser>();
list = new List<ADUser>(ws.GetUserList());


This is the error I get:
The best overloaded method match for 'System.Collections.Generic.List<WindowsFormsApplication1.ADUsers>.List(System.Collections.Generic.IEnumerable<WindowsFormsApplication1.ADUsers>' has some invalid arguments

and if I user list = ws.GetUserList(); I get the error:
Cannot implicitly convert type 'WindowsFormsApplication1.myService.ADUsers[]' to 'System.Collections.Generic.List<WindowsFormsApplication1.ADUsers>

I have tried list.AddRange I have tried Arrays. All I want is the list that gets populated in my web service to be returned to my application.

Could you please help..

Thanks
AnswerRe: Return List frrom WebMethod Pin
TheGreatAndPowerfulOz26-Jan-11 7:51
TheGreatAndPowerfulOz26-Jan-11 7:51 
GeneralRe: Return List frrom WebMethod Pin
huge_superman26-Jan-11 9:46
huge_superman26-Jan-11 9:46 
GeneralRe: Return List frrom WebMethod Pin
TheGreatAndPowerfulOz26-Jan-11 10:04
TheGreatAndPowerfulOz26-Jan-11 10:04 
GeneralRe: Return List frrom WebMethod Pin
Pete O'Hanlon26-Jan-11 10:04
mvePete O'Hanlon26-Jan-11 10:04 
QuestionGet assembly name that called class library Pin
Chesnokov Yuriy26-Jan-11 1:23
professionalChesnokov Yuriy26-Jan-11 1:23 

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.