Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just noticed, you're calling <code>View()</code> but not passing it a model, then in the view you're referencing <code>Model.profile</code>. Inevitably <code>Model</code> is null, and therefore has no <code>profile</code> property to access. Make sure you're passing the model off to the view in the <code>return View(model)</code> call.</p> <hr> <p><em>Follow-up for collections</em></p> <p>I've always found that any time you have variable that implements <code>IEnumerable&lt;T&gt;</code>, it's best to populate it with an empty set over a <code>null</code> value. That is to say:</p> <pre><code>// no-nos (IMHO) IEnumerable&lt;String&gt; names = null; // this will break most kinds of // access reliant on names being populated // e.g. LINQ extensions // better options: IEnumerable&lt;String&gt; names = new String[0]; IEnumerable&lt;String&gt; names = Enumerable.Empty&lt;String&gt;(); IEnumerable&lt;String&gt; names = new List&lt;String&gt;(); </code></pre> <p>Unless you like checking <code>if (variable != null &amp;&amp; variables.Count() &gt; 0)</code> every time you want to access it, make it an empty collection and leave it at that.</p> <p>To come full-circle, as long as the variable is populated with a collection of some sort (empty or populated) a <code>foreach</code> shouldn't break. it will simply skip past the code block and not output anything. If you're getting an object null error, it's most likely because the variable is empty and the enumerator could not be retrieved.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload