Click here to Skip to main content
15,895,423 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Get assembly name that called class library Pin
Pete O'Hanlon26-Jan-11 1:31
mvePete O'Hanlon26-Jan-11 1:31 
GeneralRe: Get assembly name that called class library Pin
Chesnokov Yuriy26-Jan-11 1:36
professionalChesnokov Yuriy26-Jan-11 1:36 
GeneralRe: Get assembly name that called class library Pin
Henry Minute26-Jan-11 2:07
Henry Minute26-Jan-11 2:07 
AnswerRe: Get assembly name that called class library Pin
Chesnokov Yuriy26-Jan-11 2:25
professionalChesnokov Yuriy26-Jan-11 2:25 
QuestionMulti-language installer in Visual Studio Deployment and Setup project Pin
linuxfedora25-Jan-11 23:23
linuxfedora25-Jan-11 23:23 
AnswerRe: Multi-language installer in Visual Studio Deployment and Setup project Pin
Pete O'Hanlon26-Jan-11 1:11
mvePete O'Hanlon26-Jan-11 1:11 
QuestionExcel Cell Copy - Update Formulas Pin
gmhanna25-Jan-11 16:35
gmhanna25-Jan-11 16:35 
AnswerRe: Excel Cell Copy - Update Formulas Pin
Dan Mos25-Jan-11 22:08
Dan Mos25-Jan-11 22:08 
QuestionLINQ and Multithreading : insert not work [modified] Pin
NoName_ark25-Jan-11 8:31
NoName_ark25-Jan-11 8:31 
AnswerRe: LINQ and Multithreading : insert not work Pin
Luc Pattyn25-Jan-11 10:24
sitebuilderLuc Pattyn25-Jan-11 10:24 
GeneralRe: LINQ and Multithreading : insert not work Pin
NoName_ark25-Jan-11 11:09
NoName_ark25-Jan-11 11:09 
AnswerRe: LINQ and Multithreading : insert not work Pin
Luc Pattyn25-Jan-11 11:22
sitebuilderLuc Pattyn25-Jan-11 11: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.