Question: I am trying to create a simple console card game in c#. I'm having a hard time figuring out how to access my players names after they've been created.

I'm trying to create an object array that stores each player in a different index. As the game develops, I will add more properties to the player class (like cards remaining).

I'm hoping to be able to display a players name, id number, etc. but am not sure how to print that value. I've tried `Console.WriteLine(playerList[i])`, but that just prints the the namespace and class. I'm also not able to do anything like `Console.writeLine(playerList[i].name)`, but that doesn't work either.

Any help or feedback is great! Thanks!

```
class Player
{
    public int id;
    public string name;
}

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Hi, enter how many players are playing");
        int numOfPlayer = int.Parse(Console.ReadLine());
        Player[] playerList = CreatePlayers(numOfPlayer);

        //What I'm trying to do! >>
        //Console.WriteLine(playerList[0].name + "'s turn")
    }

    static Player[] CreatePlayers(int amountOfPlayers)
    {
        Player[] playerList = new object[amountOfPlayers];

        for (int i = 0; i < amountOfPlayers; i++)
        {
            Console.WriteLine("Enter a name for player " + (i + 1));
            string playerName = Console.ReadLine();
            Player player = new Player();
            player.id = i;
            player.name = playerName;
            playerList[i] = player;
        }
        return playerList;
    }
}

```

EDIT: 
I've changed the Object array into a player array, and I've updated it in the code above. I seem to be able to access the name now by writing Console.Writeline(playerList[0].name.ToString()). Is this a decent way to do it?

Answer: 
you cannot use where condition inside `Include` or `ThenInclude`. What you can do is:

```
var templatesFields = await _context.Sections
    .Include(x => x.Subtitles)
    .ThenInclude(r => r.Fields)
    .ThenInclude(r => r.OptionSources)
    .ThenInclude(r => r.OptionsSourcesDetails)
    .Where(t=>t.Subtitles.Fields.Any(x => x.TemplatesFields.TemplateID==TemplateID))
    .ToListAsync();

```

EDIT: This will be possible with .Net Core 5.0 (which is in preview right now)

```
var blogs = context.Blogs
    .Include(e => e.Posts.Where(p => p.Title.Contains("Cheese")))
    .ToList();

```

[Filtered Include](https://www.learnentityframeworkcore5.com/whats-new-in-ef-core-5/filtered-included)
From [this](https://stackoverflow.com/a/42063725):

> 
> Filtering in `Include` or `ThenInclude` is not supported. Create projection by using `Select`:
> 
> 
> 
> ```
> questionnaire = _context.Questionnaires
>     .Select(n => new Questionnaire
>     {
>         Id = n.Id,
>         Name = n.Name,
>         Questions = n.Questions.Select(q => new Question
>         {
>            Id = q.Id,
>            Text = q.Text,
>            Answers = q.Where(a => a.UserId == userId).ToList()
>         }).ToList()
>     })
>     .FirstOrDefault(qn => qn.Id == questionnaireId);
> 
> ```
> 
>