0

Actually I'm using this code at universal app on the shared section

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

namespace Tablaturas
{
    public class SeparadorDeSilabas
    {

        ArrayList posiciones; // Posiciones de inicio de las silabas
        String ultPal;        // Última palabra tratada, se guarda para
                              // no repetir el proceso si se pide la misma
    }
}

Now my problem is that ArrayList type resides at System.Collections But the compiler doesn't recognize it.

How can I do to use ArrayList at universal app? or

There is another equivalent type for universal app?

Juan Pablo Gomez
  • 5,203
  • 11
  • 55
  • 101

2 Answers2

4

There hasn't been a good reason to use ArrayList in new code for the last 9 years, but it's still around for backwards compatibility. With UWP they've taken the opportunity to purge the old legacy.

You can always replace an ArrayList with a List<object>. You can almost always do better to replace it with a List<T> for a more specific type unless you've a heterogeneous collection (one that contains items of lots of different types). Being more specific will generally give you code that is safer, faster (removing some unnecessary casting) and will possibly find some bugs in the original that you can then fix.

Jon Hanna
  • 110,372
  • 10
  • 146
  • 251