asp.net mvc - Can't get to property in razor foreach -


i'm still new mvc , razor , i'm hoping can me out something. able use following code print line (using @reply.getproperty("propertyname") when try assign variable (test) code fails. why , how can around it? need able assign , use further in other code.

    @foreach (var reply in currentpage.children)     {         @reply.getproperty("propertyname")         @{             string test = reply.getproperty("propertyname");         }     } 

in view

@{    string test = string.empty;  }  @foreach (var reply in currentpage.children)     {         @reply.getproperty("propertyname")         test = reply.getproperty("propertyname");      } 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -