我希望将一个对象作为defUserInfo
方法的默认值,但由于它不是一个编译时常量
,所以这是不可能的。是否有其他方法可以使其正常工作?
private static CustomerIdentifications defUserInfo = new CustomerIdentifications
{
CustomerID = "1010",
UniqueIdentifier = "1234"
};
public static HttpResponseMessage GenerateToken<T>(T userInfo = defUserInfo)
{
// stuff
return response;
}