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?

    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; }
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

create an operation contract with parameter named ID of your type.
Let's say the service looks like:-
interface IMyService
string Operation(int ID);

public class MyService : IMyService
public string Operation(int ID)
return ID.ToString();

//Here is the client Code
using(var proxy=new MyServiceClient())
var strRet=proxy.Operation(10);
//Here 10 would be returned

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CipherISAuthor Commented:
My WCF is fine.  I just need to pass the ID to the class and use that ID in the class.
kaufmed   ( ͡° ͜ʖ ͡°)*whispers*  I C# people.Commented:
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.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

i have passed ID in the my example and used it in Service Class
CipherISAuthor Commented:
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.

CipherISAuthor Commented:
I figured it out.  Thaks for your help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.