C#错误:已经定义了一个名为'Fan'的成员,其参数类型相同“ [英] C# error : already defines a member called 'Fan' with the same parameter types"
本文介绍了C#错误:已经定义了一个名为'Fan'的成员,其参数类型相同“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
class Fan
{
class Fan
{
private int speed = 1;
private bool on = true;
private double raduis = 5.0;
private string color = "blue";
public int spee { get { return speed; } set { speed = value; } }
public bool o { get { return on; } set { on = value; } }
public double radu { get { return raduis; } set { raduis = value; } }
public string colour { get { return color; } set { color = value; } }
public Fan(int speed, bool on, double raduis, string color)
{
this.speed = speed;
this.on = on;
this.raduis = raduis;
this.color = color;
}
public Fan(int se)
{
speed = se;
}
public Fan(int se , bool t )
{
speed = se ;
on = t;
}
public Fan(int se, bool t , double r)
{
speed = se;
on = t;
raduis = r;
}
public Fan(int seo, bool to, double ro, string ce)
{
speed = seo;
on = tp;
raduis = ro;
color = ce;
}
public string DisplayFan()
{
String printme = null;
if (fan.on = true)
{
printme = ("Speed: " + get.spee() + " Color: " + fan.color + " Radius: " + fan.radius);
}
if (fan.on = false)
{
printme = ("Color: " + fan.color + " Radius: " + fan.radius + " Fan is Off");
}
return (printme);
}
}
static void Main(string[] args)
{
Fan f1 = new Fan();
f1.spee(3);
f1.radu(10.0);
f1.colour("Yellow");
f1.DisplayFan(true);
Fan f2 = new Fan();
f2.spee(1);
f2.radu(5.0);
f2.colour("blue");
f2.DisplayFan(false);
}
}
}
C#错误:
C# error:
already defines a member called 'Fan' with the same parameter types"
推荐答案
这不是自我解释..
Isn't it self explaining ..
public Fan(int seo, bool to, double ro, string ce)
{
speed = seo;
on = tp;
raduis = ro;
color = ce;
}
和
and
public Fan(int speed, bool on, double raduis, string color)
{
this.speed = speed;
this.on = on;
this.raduis = raduis;
this.color = color;
}
查看代码,您有以下构造函数:
Look at your code, you have the following constructors:
public Fan(int speed, bool on, double raduis, string color)
{
this.speed = speed;
this.on = on;
this.raduis = raduis;
this.color = color;
}
// 3 others removed for clarity
public Fan(int seo, bool to, double ro, string ce)
{
speed = seo;
on = tp;
raduis = ro;
color = ce;
}
您不能拥有两个具有相同签名的,删除您不想要的签名。
You cannot have two with the same signature, remove the one that you do not want.
I我在VS2010中运行得很好的银灯应用程序中出现此错误,当我在VS2013中对它进行操作时,它为所有初始化方法提供此错误,并且服务未被提及,我的服务正常工作。
I am getting this error in one of the silver light application which works fine in VS2010 bu when i oprned it in VS2013 its giving this error for all the initialize methods and also the services are not getting reffered, my services works fine.
这篇关于C#错误:已经定义了一个名为'Fan'的成员,其参数类型相同“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文