user1590636
user1590636

Reputation: 1194

passing static variables to a function

i have the following global variables

private static Queue<List<object>> webdata1Queue = new Queue<List<object>>();
private static Queue<List<object>> webdata2Queue = new Queue<List<object>>();
public static DataTable products1;
public static DataTable products2;

and this function

private void Downloader(Queue<List<object>> webdataQueue,Datatable products)
        {
        }

is this the right way to pass static variables to a function? i need to pass the declared variables because i will be using the same function with 2 different threads.

Upvotes: 1

Views: 1704

Answers (1)

fenix2222
fenix2222

Reputation: 4730

If you are going to assign null to that variable or initialize it inside method then it wont work, but you can pass it like you are doing if you are just modifying properties of it and adding items to list.

Upvotes: 1

Related Questions