Reputation: 14684
I want to make a TryGetValue
in 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.
Upvotes: 0
Views: 1061
Reputation: 133403
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>
Upvotes: 1