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',因为它不是委托类型
我有一个方法将字符串传递给类.出于测试原因,我现在使用了一个按钮.我在论坛中搜索了类似的问题,但他们提到了php和其他我无法理解的情况.该类从字符串中删除几个字符,并根据标题将值分配给3个不同的字符串.我需要将这3个字符串返回给调用者,并将其编码为以下内容.
呼叫者:
private void button4_Click(object sender, EventArgs e)
{
string a, b, c;
string invia = textBox8.Text.ToString();
Stripper strp = new Stripper();
strp.Distri(invia, out a, out b, out c);
textBox7.Text = a;
textBox7.Text = b;
textBox7.Text = c;}
Run Code Online (Sandbox Code Playgroud)
类:
class Stripper
{
public void Distri (string inArrivo, out string param1, out string param2, out string param3)
{
string corrente="";
string temperatura="";
string numGiri="";
string f = inArrivo;
f = f.Replace("<", "");
f = f.Replace(">", "");
if (f[0] == 'I')
{ …Run Code Online (Sandbox Code Playgroud)