IEnumerable<T> returning function implemented using 'yield return' versus creating a collection : <p>I am debating which of the following is an efficient way to implement the function <code>CreatePlayerData</code></p>

<pre><code>Method1: yield return
private static IEnumerable&lt;IPlayerData&gt; CreatePlayerData(int gameId, PlayerProfiles profiles)
{
    foreach (var data in profiles.data)
    {
        yield return new PlayerData
        {
            GameId = gameId,
            GameName = data.GameName,
            ProfileId = data.ProfileId
        };
    }
}

Method2: Creating a collection
private static IEnumerable&lt;IPlayerData&gt; CreatePlayerData(int gameId, PlayerProfiles profiles)
{
    var collection = new List&lt;IPlayerData&gt;();
    foreach (var data in profiles.data)
    {
        collection.Add(new PlayerData
        {
            GameId = gameId,
            GameName = data.GameName,
            ProfileId = data.ProfileId
        });
    }
    return collection;
}
</code></pre>

<p>There is a log function that uses function <code>CreatePlayerData</code> as an argument:
The signature of the log function is:</p>

<pre><code>void LogPlayerData(IEnumerable&lt;IPlayerData&gt; players);
</code></pre>

<p>If I use <code>Method1</code> to implement <code>CreatePlayerData</code> function, I call the log function as:</p>

<pre><code>LogPlayerData(CreatePlayerData().ToArray());
</code></pre>

<p>Or if I use <code>Method2</code> to implement <code>CreatePlayerData</code> function, I call the log function as:</p>

<pre><code>LogPlayerData(CreatePlayerData());
</code></pre>

<p>Not sure which among <code>Method1</code> or <code>Method2</code> is the best way to implement the function <code>CreatePlayerData</code>. Any suggestions?</p>
