Update: After several attempts, figured out even String can not be recognized but string.
If I create new project from MVC template, while debugging in immediate window I can do:
var a = new List<int>{1,2,3};
a.First()
However in my existing project, If I try to do same:
var a= new List{1,2,3};
it gives me
error CS0246: The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)
On the other hand, I can do this.
var a = new System.Collections.Generic.List<int>{1,2,3};
but this time
a.First()
gives me
error CS1061: 'List<int>' does not contain a definition for 'First' and no accessible extension
I have also on top razor view page
@using System;
@using System.Linq;
@using System.Collections.Generic
In fact, everything is used to working in the past with out doing any changes in web config.
I tried several attempts such as this and this one
What could be wrong with my existing project that I can not use nor List neither Linq expression?
My real case is, I want to use linq lambda expression in my razor view while debugging.
Mystery solved, in my view I have Kendo ui mvc fluent expression:
@(Html.Kendo().Window()
.Modal(true)
.Width(350)
.Height(280)
.Actions(a => a.Custom("ActivateRole"))
.Animation(true)
.Content(FormContent().ToHtmlString())
.Name("RoleSelector")
.Events(eve => eve.Activate("centerKendoWindow"))
.Title("Role selection")
)
form form content, I have
@helper FormContent()
{
}
So for this, I am "loosing context" then all namespaces ignored.