C# Task.Result is Null : <p>I have following method which will eventually return some <code>Task&lt;IList&lt;DataModel&gt;&gt;</code> but for now just returns <code>null</code>.  I want to load result of this list to ObservableCollection in my ViewModel which is then displayed in a ListView.</p>

<p>But for now, I just want to return null and check that that is handled properly, so my ListView should show nothing in it as a result.  I simmulate that by this code:</p>

<pre><code>public async Task&lt;IList&lt;DatatModel&gt;&gt; GetData(string id)
{
    return await Task.FromResult&lt;IList&lt;DataModel&gt;&gt;(null);
}
</code></pre>

<p>I call the code above and will loop through result of my Task and load it all in my ObservableCollection like so:</p>

<pre><code>public void Initialize()
{
    foreach (var data in GetData(Id).Result)
    {
        MyObservableCollection.Add(data);
    }
}
</code></pre>

<p>However, my app just freezes.  I think that above call to GetData(id).Result is problem because Result is null.  How do I loop through this data and load it into my ObservableCollection if some data exist, or simply dont load anything if there is no data returned?</p>
