Answers for "i have a list with elements from several classes and i need to check of which class belongs each element c#"

C#
0

List of 2 different iherent classes c#'

List<BaseA> list = ...

  var result = list
    .OfType<AA>() // Filter out AA instances only
    .ElementAt(0) // or just First();
    .AID;
Posted by: Guest on August-23-2020

Code answers related to "i have a list with elements from several classes and i need to check of which class belongs each element c#"

C# Answers by Framework

Browse Popular Code Answers by Language