Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
8
Reply
static variable remove and c# duplication problem
Mani Kandan
Dec 25 2016 3:10 AM
274
Reply
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,
foreach
(DocumentsUser item
in
listView1.SelectedItems)
{
ImgName.Add(item.Parent_File_Name);
UserId.Add((
int
)item.UserId);
}
private
static
readonly
List<
string
> imgName =
new
List<
string
>();
public
static
List<
string
> ImgName {
get
{
return
imgName; } }
private
static
readonly
List<
int
> userId =
new
List<
int
>();
public
static
List<
int
> UserId {
get
{
return
userId; } }
And this is 2nd class, I want to access class 1 list each object.
foreach
(var userId
in
Qscan.UC_FileMgmt.UserId)
{
foreach
(var imgName
in
Qscan.UC_FileMgmt.ImgName)
{
Please help me...
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
8
)
Next Recommended Forum
what are the method types we are using in c# and why?
why we want to use generic collections in c#