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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:53:45+00:00 2026-06-05T07:53:45+00:00

below is the code of my class. The code creates an ArrayList. It then

  • 0

below is the code of my class. The code creates an ArrayList. It then adds a number of “PipesList” to the ArrayList, adding Pipes within each list.

I want to write a method -RemoveTheSmallPipes to get rid of all of the pipes with lengths less than 19. For which, I have written a piece of code which I don’t know works or not! as the code throws an error:

Compiler Error Message: CS0050: Inconsistent accessibility: return type ‘System.Collections.Generic.List’ is less accessible than method ‘Program.RemoveTheSmallPipes(System.Collections.Generic.List)’

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Class1
/// </summary>




   public class Program
    {
        static void Main(string[] args)
        {
            List<PipesList> lstPipeTypes = new List<PipesList>();

        lstPipeTypes.Add(new PipesList("PVC Pipes"));
        lstPipeTypes[0].Pipes.Add(new Pipe("The blue pipe", 12));
        lstPipeTypes[0].Pipes.Add(new Pipe("The red pipe", 15));
        lstPipeTypes[0].Pipes.Add(new Pipe("The silver pipe", 6));
        lstPipeTypes[0].Pipes.Add(new Pipe("The green pipe", 52));

        lstPipeTypes.Add(new PipesList("Iron Pipes"));
        lstPipeTypes[1].Pipes.Add(new Pipe("The gold pipe", 9));
        lstPipeTypes[1].Pipes.Add(new Pipe("The orange pipe", 115));
        lstPipeTypes[1].Pipes.Add(new Pipe("The pink pipe", 1));

        lstPipeTypes.Add(new PipesList("Chrome Pipes"));
        lstPipeTypes[2].Pipes.Add(new Pipe("The grey pipe", 12));
        lstPipeTypes[2].Pipes.Add(new Pipe("The black pipe", 15));
        lstPipeTypes[2].Pipes.Add(new Pipe("The white pipe", 19));
        lstPipeTypes[2].Pipes.Add(new Pipe("The brown pipe", 60));
        lstPipeTypes[2].Pipes.Add(new Pipe("The peach pipe", 16));


        lstPipeTypes = RemoveTheSmallPipes(lstPipeTypes);

        foreach (var pipeList in lstPipeTypes)
        {
            Console.WriteLine("PipesList: {0}", pipeList.pipeType);

            foreach (var pipe in pipeList.Pipes)
            {
                Console.WriteLine("{0}, length: {1}", pipe.name, pipe.length);
            }
            Console.WriteLine();
        }

        Console.WriteLine("Done, press return to exit");
        Console.ReadLine();
    }


    public static List<PipesList> RemoveTheSmallPipes(List<PipesList> lstPipeTypes)
    {

        //Place your code in here
        //It should remove all pipes that have lengths lower than 19.


        foreach (var pipeList in lstPipeTypes)
        {

            foreach (var pipe in pipeList.Pipes)
            {

                    lstPipeTypes.RemoveAll(i => pipe.length < 19);

            }

        }

        return lstPipeTypes;

    }
}

class PipesList
{
    public string pipeType;
    public List<Pipe> Pipes;

    public PipesList(string newBoxType)
    {
        pipeType = newBoxType;
        Pipes = new List<Pipe>();
    }
}

class Pipe
{
    public string name;
    public float length;

    public Pipe(string newName, float newLength)
    {
        this.name = newName;
        this.length = newLength;
    }
}
  • 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-05T07:53:48+00:00Added an answer on June 5, 2026 at 7:53 am

    Your PipesList class is internal, so it’s only visible to other code within the same assembly. Your RemoveTheSmallPipes method is public, but refers to PipesList in its signature. That’s not allowed.

    Either make RemoveTheSmallPipes method internal, or make PipesList public.

    Your implementation is also somewhat odd, by the way. It’s unclear why you’ve got two levels of loops and a RemoveAll call, but the fact that you don’t use your lambda expression parameter (i) within the body of the lambda expression is very suspicious. It’s not clear what you’re trying to do, but I don’t think your code does what you expect at the moment…

    EDIT: Based on your description, I suspect the body should look like this:

    foreach (var pipeList in lstPipeTypes)
    {
        pipeList.Pipes.RemoveAll(pipe => pipe.length < 19);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the code below. I do not want to create multiple instances of class
The code for each part is displayed below. This is the class wherein the
I have the below code to create a class in javascript.... Now i will
What would be PHP code equivalent for snippets below: C# Code : class Composite
Please have a look at the code below: Class A package generalscenarios; public class
I'm getting this error message with the code below: class Money { public: Money(float
below code is my databasehandler class i got it from a tutorial. Beside that
The below code is a web service response format.This class has two reference variables
I have the code below : public class Anything { public int Data {
I am using the below code in my test class , to load all

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.