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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:17:33+00:00 2026-05-21T04:17:33+00:00

I have a arraylist in my web application project in asp.net/C#/VS2008 and I’m using

  • 0

I have a arraylist in my web application project in asp.net/C#/VS2008 and I’m using .net 3.5

I’m adding contents to the arraylist using a class which is defined as follows:

using System.Web;

class ShoppingCartDataStore
{
    private string componentName;
    private string componentPrice;
    private string componentFileSize;
    private string componentDescription;

    public ShoppingCartDataStore(string componentName, string componentPrice, string componentFileSize, string componentDescription){
        this.componentName = componentName;
        this.componentPrice = componentPrice;
        this.componentFileSize = componentFileSize;
        this.componentDescription = componentDescription;
    }

    public string ComponentName
    {
        get
        {
            return this.componentName;
        }
    }

    public string ComponentPrice
    {
        get
        {
            return this.componentPrice;
        }
    }

    public string ComponentFileSize
    {
        get
        {
            return this.componentFileSize;
        }
    }

    public string ComponentDescription
    {
        get
        {
            return this.componentDescription;
        }
    }
}

and I’m adding contents to the arraylist by following code:

ArrayList selectedRowItems = new ArrayList();
selectedRowItems.Add(new ShoppingCartDataStore(componentName, componentPrice, fileSize, componentDescription));

Suppose I want to search this arraylist after adding few values in this manner with componentName as the key. I tried the following code but I’m just not able to find a way to do this:

ArrayList temporarySelectedItemsList = new ArrayList();
ArrayList presentValue = new ArrayList();
string key = componentName; //some specific component name
temporarySelectedItemsList = selectedRowItems;
for (int i = 0; i < temporarySelectedItemsList.Count; i++)
{
    presentValue = (ArrayList)temporarySelectedItemsList[i];
}
  • 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-21T04:17:33+00:00Added an answer on May 21, 2026 at 4:17 am
    var results = selectedRowItems.OfType<ShoppingCartDataStore>().Where(x=>x.ComponentName == "foo")
    

    of course you could get rid of the OfType if you were using a generic list rather than a arraylist

    EDIT: So, I have no idea why you would NOT use LINQ or generics if you are in 3.5. But if you must:

    ArrayList results = new ArrayList();
    
    
    foreach (ShoppingCartDataStore store in selectedRowItems)
    {
        if(store.ComponentName == "foo"){
            results.Add(store);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my spring web application I have arraylist in model attribute which I want
At the moment inside the class I have ArrayList which the objects are stored
i have an arraylist of strings in my servlet which im passing forwarding using
I have an arraylist which has a class datastructure. public class empRec { public
I've got an ASP.NET application that I installed by creating a web setup. I
I have just created a mid-sized web-application using Java, a custom MVC framework, javascript.
Using Java, I have a class which retrieves a webpage as a byte array.
I have developed a web application using Spring 3.1 In one of the module
I'm using Apache CXF for my restful web services. I have a service defined
i have the following action class: package com.pendulum.web; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest;

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.