C#C
C#3y ago
14 replies
Dropps

❔ simplification

iam wondering if there is a way to simplify following example for readability using linq

object outerobject = new();
object apiData = new();
foreach (ObjectX x in apiData.Keys)
{
     foreach (List<ObjectY> yList in apiData.Values)
     {
          outerobject.Components.Add(new Components
          {
               property = x,
               propertyList = x
           });
     }
}
Was this page helpful?