error方法必须具有返回类型

时间:2011-04-18 03:50:05

标签: c# .net

这是我的类文件我收到错误,因为“方法必须有返回类型

public class Users 
{
  public string FirstName { get; set; }
  public string LastName { get; set; }
}
public class UsersList : List<Users>
{
  public UsersList 
 {
   this.Add(new Users() { FirstName = "John", LastName = "Lock"}); 
   this.Add(new Users() { FirstName = "James", LastName = "Soyer"}); 
   this.Add(new Users() { FirstName = "Jack", LastName = "Sephered"}); 
 }
}

我正在尝试绑定到自定义实例集合的静态资源

1 个答案:

答案 0 :(得分:4)

...

public UsersList()
{
    ...
}