什么是在mvc中创建列表的语法 [英] what is syntax for creating list in mvc

查看:52
本文介绍了什么是在mvc中创建列表的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码适用于类

公共类EmployeeViewModel

{

public string EmployeeName {get;组; }

public string Salary {get;组; }

公共字符串SalaryColor {get;组; }

}



以下代码创建列表但我收到以下错误



  public   class  EmployeeListViewModel 
{
public 列表< EmployeeViewModel>< employeeviewmodel>员工{获取; set ; }
public string UserName { get ; set ; }
}



请帮助我,我是mvc的新手

解决方案

而不是

  public 列表< Employeeviewmodel>< employeeviewmodel>员工{获取;  set ; } 



使用

  public 列表< Employeeviewmodel>员工{获取;  set ; } 


the following code is for class
public class EmployeeViewModel
{
public string EmployeeName { get; set; }
public string Salary { get; set; }
public string SalaryColor { get; set; }
}

following code for creations of list but i am getting the following error

public class EmployeeListViewModel
{
    public List<EmployeeViewModel><employeeviewmodel> Employees { get; set; }
    public string UserName { get; set; }
}


pls help me i am new to mvc

解决方案

Instead of

public List<Employeeviewmodel><employeeviewmodel> Employees { get; set; }


Use

public List<Employeeviewmodel> Employees { get; set; }


这篇关于什么是在mvc中创建列表的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆