调试和发布模式下的不同AutoLogin URL

时间:2016-09-27 08:13:01

标签: c# asp.net asp.net-mvc

是否可以在一行代码中简化这一过程?

感谢。

public static string BuildAutoLoginUrl(string username)
{
#if DEBUG
   return @"/Account/AutoLogin?key=" + GetAutoLoginKey(username);
#else
   return @"http://www.domain.com/Account/AutoLogin?key=" + GetAutoLoginKey(username);
#endif
}

1 个答案:

答案 0 :(得分:-1)

根据the documentation for C# preprocessor directives,它说明如下:

  

预处理程序指令必须是一行上的唯一指令。

因此答案是否定的,不可能将代码减少到一行。