主题:关于color引用的命名空间问题
先贴上代码,再细说
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace _12
{
class Program
{
class Fruit
{
public double weight;
public int count;
public Color color;
}
class orange : Fruit
{
public string taste;
public orange(double pweight, int pcount, Color pcolor, string ptaste)
{
weight = pweight;
count = pcount;
color = pcolor;
taste = ptaste;
}
public void Description()
{
Console.WriteLine("weight={0},count={1},color={2},taste={3}", weight, count, color, taste);
}
}
static void Main(string[] args)
{
orange or = new orange(2.5, 10, Color.OrangeRed, "quite good");
or.Description();
}
}
}
这是一个很简单的继承的小例子,但是在运行的过程中发现,Color 不能找到
弹出错误错误 1 找不到类型或命名空间名称“Color”(是否缺少 using 指令或程序集引用?)
但是color明明是在system.drawing中,求高手赐教
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace _12
{
class Program
{
class Fruit
{
public double weight;
public int count;
public Color color;
}
class orange : Fruit
{
public string taste;
public orange(double pweight, int pcount, Color pcolor, string ptaste)
{
weight = pweight;
count = pcount;
color = pcolor;
taste = ptaste;
}
public void Description()
{
Console.WriteLine("weight={0},count={1},color={2},taste={3}", weight, count, color, taste);
}
}
static void Main(string[] args)
{
orange or = new orange(2.5, 10, Color.OrangeRed, "quite good");
or.Description();
}
}
}
这是一个很简单的继承的小例子,但是在运行的过程中发现,Color 不能找到
弹出错误错误 1 找不到类型或命名空间名称“Color”(是否缺少 using 指令或程序集引用?)
但是color明明是在system.drawing中,求高手赐教