Conditions using foreach in C #

0

I need to do a foreach in C # , in which several conditions must be done like this:

  • a can be of type 1 , 2 , 3 or 4 .
  • b can be of type 1 , 2 , 3 or 4 .

The set of a plus its type gives a different ID depending on the combination.

To achieve this, I tried to program the following code:

foreach (DocumentoMetadatosHijo hijo in documento.MetadatosHijo)
{
    //Decision 1
    List<Metadata> hijoList = new List<Metadata>();
    Dt hijodoctype = _taxo.dt.Where(
        x => x.id == hijo.TipoDocID.ToString() &&
        x.TipoComprobante == hijo.TipoComprobante
    ).FirstOrDefault();

    //Decision 2
    Dt hijodoctype2 = _taxo.dt.Where(
        x => x.id == hijo.TipoDocID.ToString() &&
        x.TipoIdentificacionPF == hijo.TipoIdentificacionPF
    ).FirstOrDefault();
}
    
asked by Memo 10.03.2017 в 21:54
source

0 answers