Link to home
Start Free TrialLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

C# - Need to pass variable to a class

I have the below code in an ASP.NET page.  It works fine.  I need to modify it.  I wrote a WCF Service and I need to call that service in the class below.  I know how to do that.

The issue I'm having is I need to pass an ID to the class to be used by my WCF Service.  Any ideas?

    //FILES
    public class FileList
    {
        static FileList()
        {
            getFiles = new List<Files>();
            getFiles.Add(new Files() { FileName = "Test.1zip" });
            getFiles.Add(new Files() { FileName = "Test2.zip" });
            getFiles.Add(new Files() { FileName = "Test3.zip" });
       }
        public static List<Files> getFiles { get; set; }
    }

    public class Files
    {
        public string FileName { get; set; }
    }
ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CipherIS

ASKER

My WCF is fine.  I just need to pass the ID to the class and use that ID in the class.
Avatar of kaufmed
Expose a property or method which takes in a parameter for the information you would like to receive. It's difficult to tell from the code you posted as to the desired result.
i have passed ID in the my example and used it in Service Class
I've attached my code in a text file.  I put a comment where I need the UserName to be passed.

Please let me know how to resolve this.

Thanks
Pass-UserName-to-AccountList.txt
I figured it out.  Thaks for your help