矩形,它在哪里?

Rect, where is it?

这让我发疯,创建新的 console 应用程序项目,然后

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

// somewhere in method
var rect = new Rect(1, 2, 3, 4); // no Rect

The type or namespace name 'Rect' could not be found (are you missing a using directive or an assembly reference?)

Rect 会怎样?

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