8
Reply

static variable remove and c# duplication problem

Mani Kandan

Mani Kandan

Dec 25 2016 3:10 AM
274
Hello everyone,
 
I want to pass list items to one class to anther class. I have used static keyword. But now, when the application is running still old variable is there.
 
This is my 1st class, 
  1. foreach (DocumentsUser item in listView1.SelectedItems)  
  2.            {  
  3.                ImgName.Add(item.Parent_File_Name);  
  4.                UserId.Add((int)item.UserId);  
  5.            }  
  6.   
  7. private static readonly List<string> imgName = new List<string>();  
  8.        public static List<string> ImgName { get { return imgName; } }  
  9.   
  10.        private static readonly List<int> userId = new List<int>();  
  11.        public static List<int> UserId { get { return userId; } }  
 And this is 2nd class, I want to access class 1 list each object.
 
  1. foreach (var userId in Qscan.UC_FileMgmt.UserId)  
  2.            {  
  3.                foreach (var imgName in Qscan.UC_FileMgmt.ImgName)  
  4.                {  
Please help me...
 
 

Answers (8)