小编Nit*_*raw的帖子

在c#中的函数中返回两个字符串

protected string Active_Frozen(string text, string color)
{
    connection();
    string query = "SELECT CustomerInfo FROM ActiveSubscription WHERE UserName=@UserName";

    SqlCommand cmd = new SqlCommand(query, conn);

    if(query=="true")
    {
       text = "Active";
       color = "Green";
    }
    else
    {
       text = "Frozen";
       color= "Red";
    }

    return (text, color);
}
Run Code Online (Sandbox Code Playgroud)

我想要返回两个字符串:文本和颜色,不确定问题是什么.

错误@ return语句:

(参数)?文字/色彩

无法将lambda表达式转换为类型'string',因为它不是委托类型

c# return

6
推荐指数
1
解决办法
3721
查看次数

标签 统计

c# ×1

return ×1