TryGetValue() in Razor

I want to make a TryGetValuein my ASP.NET MVC3 Razor view, the code looks like this:

@var out;
@Model.Dic.TryGetValue(1, out);
<script type="text/javascript">alert(@out);</script>

I'm getting an error CS0839: Missing Argument. and i dont know why

EDIT Now I changes it to:

@var myOut;
@Model.Dic.TryGetValue(1, out myOut);
<script type="text/javascript">alert(@myOut);</script>

Now I get: "var" is not available in this context.

Answers


try this, based on understanding. I have not executed it.

@{
  var myOut;
  Model.Dic.TryGetValue(1, out myOut);
}
<script type="text/javascript">alert(@myOut);</script>

Need Your Help

Inventory/Stock Management

c# sql asp.net linq

I am working on a project where I have Three Table: Inventory, Stock &amp; Purchase. I can only purchase individual products when The quantity in inventory Table is less Than The quantity in stock ...

java regex expression, everything other than letter characters/strings

java regex hash hashtable

I'm writing a hashTable program. I only need to hash values that are either words, or single characters. I will define a word as anything that doesn't have a space or punctuation, and a character i...