Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to search and remove lower values from arraylist of boxofwidgets in c#
    primarykey
    data
    text
    <p><br> How to search through array list of "BoxOfWidgets" of and remove the widgets with values less than 20 using the method "GetRidOfTheSmallWidgets" in c# without using foreach or any loops. <br/></p> <pre><code>using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { ArrayList colBoxesOfWidgets = new ArrayList(); colBoxesOfWidgets.Add(new BoxOfWidgets("Cardboard")); ((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The blue widget", 12)); ((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The red widget", 15)); ((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The silver widget", 6)); ((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The green widget", 52)); colBoxesOfWidgets.Add(new BoxOfWidgets("Metal")); ((BoxOfWidgets)colBoxesOfWidgets[1]).colWidgets.Add(new Widget("The gold widget", 9)); ((BoxOfWidgets)colBoxesOfWidgets[1]).colWidgets.Add(new Widget("The orange widget", 115)); ((BoxOfWidgets)colBoxesOfWidgets[1]).colWidgets.Add(new Widget("The pink widget", 1)); colBoxesOfWidgets.Add(new BoxOfWidgets("Metal")); ((BoxOfWidgets) colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The grey widget", 12)); ((BoxOfWidgets) colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The black widget", 15)); ((BoxOfWidgets) colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The white widget", 19)); ((BoxOfWidgets) colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The brown widget", 60)); ((BoxOfWidgets) colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The peach widget", 16)); GetRidOfTheSmallWidgets(colBoxesOfWidgets); } public static ArrayList GetRidOfTheSmallWidgets(ArrayList colBoxesOfWidgets) { //It should remove all widgets that have lengths lower than 20. return colBoxesOfWidgets; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload