I need to do a foreach
in C # , in which several conditions must be done like this:
-
a
can be of type1
,2
,3
or4
. -
b
can be of type1
,2
,3
or4
.
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();
}