Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Rect,它在哪里?_C#_Rect - Fatal编程技术网

C# Rect,它在哪里?

C# Rect,它在哪里?,c#,rect,C#,Rect,这让我抓狂,创建新的控制台应用程序项目,然后 // adding it as reference of course using System.Windows; // somewhere in method var rect = new Rect(1, 2, 3, 4); // no Rect 找不到类型或命名空间名称“Rect”(是否缺少using指令或程序集引用?) 如何使用?您应该添加WindowsBase.dll作为对项目的引用。使用不会添加引用。它从已加载的文件中“导入”名称空间r

这让我抓狂,创建新的控制台应用程序项目,然后

// adding it as reference of course
using System.Windows;

// somewhere in method
var rect = new Rect(1, 2, 3, 4); // no Rect
找不到类型或命名空间名称“Rect”(是否缺少using指令或程序集引用?)


如何使用?

您应该添加
WindowsBase.dll
作为对项目的引用。

使用
不会添加引用。它从已加载的文件中“导入”名称空间references@PanagiotisKanavos,我知道这一点(参见示例中的第一条注释)。我的错误是没有足够注意引用哪个dll。我引用的是
System.Windows
,这还不够。我忘记了什么名称空间可以放入多个程序集中。