Converting Collection from VB to C #

0

In a conversion from vb.net to C# I have the following Line:

Public Function getImageData(ByVal sImageID As String, ByVal rutaConfiguracionImagenes As String)
Dim caracteristicasImagenes As New ArrayList
Try
    Dim datosImagenes As Collection = ReadXML(rutaConfiguracionImagenes)
    sImageData = CType(datosImagenes.Item(sImageID), ImageData) '.... demás código

When converting to C #:

public ArrayList getImageData(string sImageID, string rutaConfiguracionImagenes)
{
    ArrayList caracteristicasImagenes = new ArrayList();
    try
    {
        List<object> datosImagenes = ReadXML(rutaConfiguracionImagenes);
        sImageData = (ImageData)datosImagenes.Item[sImageID];//Item da error

I am using converter vb to c# de telerik the error that shows is the following:

  

'List' does not contain a definition for 'Item' and no   accessible extension method 'Item' accepting a first argument of type   'List' could be found (are you missing a using directive or an   assembly reference?)

Note: in vb dataImages is as Collection and in c# I converted it to list<object>

    
asked by ger 04.12.2018 в 14:27
source

1 answer

-2

ArrayList has no a Items property to access the elements of the array. However you can use the acceso por indice to obtain an element of the array:

var sImageData = (ImageData)datosImagenes[0];
    
answered by 04.12.2018 / 14:35
source