Social Icons

Mostrando las entradas con la etiqueta FOREACH. Mostrar todas las entradas
Mostrando las entradas con la etiqueta FOREACH. Mostrar todas las entradas

miércoles, 27 de julio de 2022

Ejemplo en c# de foreach

 // See https://aka.ms/new-console-template for more information


Shapefile sh1 = new Shapefile("punto", "UTM Z18S", 1);

Shapefile sh2 = new Shapefile("linea", "UTM Z18S", 2);


Shapefile[] arrayShapefile= new Shapefile[2];


arrayShapefile[0] = sh1;

arrayShapefile[1] = sh2;



for(int i=0;i<arrayShapefile.Length;i++)

{

    arrayShapefile[i].getShapefile1();

}


foreach(Shapefile iterador in arrayShapefile)

{

    Console.WriteLine(iterador.getShapefile2());

}



class Shapefile

{

    //Propiedades

    string geometria;

    string sistemaref;

    int cantidad;

    //Definición Constructor

    public Shapefile(string geometria, string sistemaref, int cantidad)

    {

        this.geometria = geometria;

        this.sistemaref = sistemaref;

        this.cantidad = cantidad;

    }


    public void getShapefile1()

    {

        Console.WriteLine(geometria);

        Console.WriteLine(sistemaref);

        Console.WriteLine(cantidad);


    }

    public string getShapefile2()

    {


        return geometria+" ggggg  "+ sistemaref+" hhhh  "+cantidad;

    }





}

Data Analyzer Error Excel

Error en copiar las celdas no se abre el Excel:  Haz clic en YES (Sí) en el mensaje de error y busca manualmente el archivo EXCEL.exe. Depen...

 
 
Blogger Templates