考虑下面的代码:简单的重构例如
public static bool UpdateUser(string userId,
string jobTitle)
{
return GetProvider().UpdateUser
(userId, jobTitle);
}
它需要被改变,可能不会返回一个布尔值,例如:
UserProfile userProfile = new UserProfile();
userProfile.Initialize(user.UserName, true);
userProfile.ProfileJobTitle = jobTitle;
userProfile.Save();
你应该确保它返回一个布尔值,或只是彻底改变方法?
这种类型的问题的正确方法是什么?
是您的第二个代码块,说明该函数的替代BODY或INVOCATION?如果是这样,UpdateUser在哪里调用? – 2010-01-21 17:14:34
为什么被标记为C++? – 2010-01-21 17:21:49