Avatar of CipherIS
CipherIS
Flag for United States of America asked on

C# List<>

I created a WCF App.  I am returning a list.  I am trying to figure out how to return it to a variable on my client page.  I also need to read the values.

Here is the call to the WCF

LogIn.MyAPILogin(this.txtUserName.Text.Trim, this.txtPassword.Text.Trim);

How do I get the values

List<LoginResults> myresults = LogIn.MyAPILogin(this.txtUserName.Text.Trim, this.txtPassword.Text.Trim);

2 boolean values are returned
- MustChangePassword
- IsAdmin
C#ASP.NET.NET Programming

Avatar of undefined
Last Comment
CipherIS

8/22/2022 - Mon
Bill Nolan

Your question is unclear.  Are you saying that "LoginResults" consists of two booleans?  And why would you receive a list of results from a single login?
CipherIS

ASKER
the sproc returns two values.  Because of this I am returning both values in a list which contains the two values.

And yes, LoginResults (as I said) contains two values:  MustChangePassword, IsAdmin.

I did not design the sproc - I have to code to it.  So I must obtain the values to determine what I have to do on the ASP.NET page.
Bill Nolan

What you actually said was "2 boolean values are returned".  Looking at your function call, it is evident that it returns a list - NOT two boolean values.  Are you actually getting two different login results, EACH containing two booleans?  It is still unclear.

I have no idea what is going on at your end.  However, it seem that regardless, you probably simply need to iterate the list and get your values:

foreach (LoginResults results in myresults)
{
   // Do something with 'results'
   if (results.bValue1 == true) whatever;
}
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
CipherIS

ASKER
Ok, lets see if I can explain this clearer.  I have developed this.

LogIn.MyAPILogin(this.txtUserName.Text, this.txtPassword.Text)

The above returns a list containing
-  MustChangePassword
-  IsAdmin

My question is how do I get those values?

The below code is an example

List<LoginResults> myresults

It does not work.
Bill Nolan

Didn't you say that LoginResults contains two bools?  Now you are saying the list contains two bools.
CipherIS

ASKER
no - loginresults is nothing - i used that as an example to get my values from WCF.  This is what I have

LogIn.MyAPILogin(this.txtUserName.Text, this.txtPassword.Text)

This returns a list with two values
-  MustChangePassword
-  IsAdmin

How do I get this list on the client side?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
CipherIS

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
CipherIS

ASKER
Figured it Out