Can't find System.Windows.Vector in C#

后端 未结 3 1089
自闭症患者
自闭症患者 2020-12-11 15:27

I\'m making a Windows Forms application in Visual Studio 2010 Ultimate, but can\'t get the built-in Vector to work.

Microsoft says that there is a System.Windows.Vec

相关标签:
3条回答
  • 2020-12-11 15:49

    To find out which assembly you have to add to your references, it can be very helpful to use a tool like ILSpy (OpenSource). There you can search for the type you need, and find out in which assembly it is implemented and which namespace you have to use.

    Finding out the implementing assembly can be quite difficult, and i have to do it often. I found it to be a fast method and thought it can help you in the future.

    0 讨论(0)
  • 2020-12-11 16:01

    Add a reference to WindowsBase.
    The Vector class is defined in the WindowsBase.dll assembly within the System.Windows namespace.

    0 讨论(0)
  • 2020-12-11 16:04

    System.Windows.Vector is a part of WPF, not Windows Forms, hence the difficulty you've having when trying to use it. You could add a reference to WindowsBase.dll, but given that it's intended for use in WPF applications, rather than Windows Forms applications, it's likely that you'd derive little benefit from doing so.

    Microsofts decision to put WPF components in System.Windows and WinForms in System.Windows.Forms is a source of endless confusion on the internet, quite what was wrong with System.Windows.Presentation or similar for WPF, I'll never know!

    0 讨论(0)
提交回复
热议问题