Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7589057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:04:24+00:00 2026-05-30T20:04:24+00:00

I have a List of tuple <Tuple<int, int>> x in that I am getting

  • 0

I have a List of tuple <Tuple<int, int>> x in that I am getting key and value as (45345, 1), (54645,0), (45345,0)
and I have a Dictionary < int, string > PathList in that I am getting key and value as (45345, asdfsd234egsgdfgs56345), (54645, 0dfsd234egsgdfgs563456), (45345,0dfsd234egsgdfgs56345234)

I am trying

    foreach (var item in PathList)
    {
       if (x.Equals(item.Key) && x[item.Key].Equals(0))
       {
         string path1 = Path.Combine(GetDirectory(item.Value), item.Value);
         File.Delete(path1);
       } 
    }

I want to check if X of id is same as PathList of id and x of value must have value 0 then enter inside the condition… what I am doing now in that in any condition I am unable to go inside the If statement.

How to check my condition?

Let me explain more: check this qus is this I am returning a list of tuple in which i am getting (54356, 0), (64643, 0), (34365, 1) in in my ascx page I have List of tuple <Tuple<int, int>> x, in this x i am getting all return value of list, now in the same ascx page I have Dictionary < int, string > PathList in that i am adding the value ImgPathList.Add(54356, 456dfhgdfg6575dfghdf); so I got 2 different list one is x and other is Pathlist.

Now i want to check. if pathlist is having the id and 54356 and x has 54356 and 0 then enter inside the if statement else show the lable msg as file can’t be delete

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:04:25+00:00Added an answer on May 30, 2026 at 8:04 pm

    I have modified my code as

     foreach (var item in PathList)
     {
        Tuple<int, int> temp = new Tuple<int, int>(item.Key, 0);
           //if (x.Equals(item.Key) && x[item.Key].Equals(0))
        if (x.Contains<Tuple<int, int>>(temp))
          {
             string path1 = Path.Combine(GetDirectory(item.Value), item.Value);
             File.Delete(path1);
           }
       }
    

    I don’t know it is a good way or not but it solved my problem…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i have a tuple that has a list as a value. F.x.
I have a list of tuples int*string where int is level and string is
I have following var result = new List<Tuple<int, List<ProductionReportEntry>, int>>(); How I can sort
I have a list of tuple, the list was sorted based on the first
I have a 3-tuple list like the following [I added line breaks for readability]:
how to write a function from list to a tuple i have taken the
I have a list that I want to use as the keys to a
I have a list of entites that contains ~137000 records that I loop through
I have following interface That I am implementing interface IReport <TOutput> { List<TOutput> GenerateReport<TInput>(TInput
I have a string variable that contain [l=9;f=0;r=5;p=2] . There are may be a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.