110,534
社区成员
发帖
与我相关
我的任务
分享
public class User
{
//这是私有构造函数,不允许外部直接new
User() { }
//这是公开的Create方法,如果条件成功,则返回User对象,失败,则返回null
public static User Create(string filter) { return null; }
}
使用时直接User.Create("条件");即可[/quote]
唉,果然只有这种方法吗?
public class User
{
//这是私有构造函数,不允许外部直接new
User() { }
//这是公开的Create方法,如果条件成功,则返回User对象,失败,则返回null
public static User Create(string filter) { return null; }
}
使用时直接User.Create("条件");即可