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 8990443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:30:05+00:00 2026-06-15T22:30:05+00:00

From the database i am getting a list of collection which has repetitive data

  • 0

From the database i am getting a list of collection which has repetitive data
for eg – total length of the List is 4 which has elements like

Item[0].Id  9
Item[1].Id  10
Item[2].id  9
Item[3].id  10

i want the collection to be of length 2 having both the Id as

Item[0].Id  9, 10
Item[1].Id  9,10
  • 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-06-15T22:30:06+00:00Added an answer on June 15, 2026 at 10:30 pm

    Your question is a little unclear, so I’m going to take your comment that you don’t want duplicates in your item collection as the question. If this is indeed accurate then I can think of two possible solutions: one is to filter duplicates when you get the data from the database, and the other is to enforce this in your c# code.

    It won’t alter the output to two integers comma separated as you’ve put in your example, but judging from your later comments this isn’t what you’re trying to do.

    SQL Solution
    You could use distinct if you’re using sql to retrieve the data, for example:

    select id from aTable
    

    becomes:

    select distinct id from aTable
    

    C# Collection Solution
    You could use the inbuilt functions of an arraylist, for example, to prevent duplicates:

    var data = new int[4];
    data[0] = 9;
    data[1] = 9;
    data[2] = 10;
    data[3] = 10;
    
    var item = new ArrayList();
    
    foreach (int i in data)
        if (!item.Contains(i)) item.Add(i);
    

    I hope one of these solves your problem! Best of luck!

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

Sidebar

Related Questions

I have a list which i am getting from database.I have 6 elements in
I am getting from database list of items ordered by descending date. I use
I am getting a list of products from my database as a BindingList. I
I have a method for getting values from database. public virtual List<TEntity> GetValues( int?
I am getting some data from my database table. The query I use is
How to retrieve data from sqlite database? Getting return value zero. -(id)init{ if(self==[super init]){
I have the following two methods for getting data from my database: - (void)
I have an issue. I am getting data from a MySQL database, and make
I am using a method which get me a list of items from database.
I have a method for getting users from a database with JDBC: public List<User>

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.