【问题标题】:Creating Device in C# (Device not recognized as keyword)在 C# 中创建设备(设备未被识别为关键字)
【发布时间】:2014-09-17 17:31:51
【问题描述】:

我决定尝试使用 C# 而不是 c++,但遇到了问题。

下面的代码 sn -p 显示了问题。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using System.Device;

namespace Project_AREA
{
    public partial class Form1 : Form
    {
        private Device device;
        public Form1()
        {
            InitializeComponent();

        }
    }
}

这就是我现在拥有的代码量。

在private Device device; 中,关键字Device 未得到识别,尽管所有库都已被引用并包含using 指令。

有什么想法吗?

【问题讨论】:

  • 在您的项目中..References 您是否也将System.Device Dll 添加到了项目中..?
  • 是的,我在项目参考中添加了 System.Device DLL。包括 using 指令 ​​using System.Device;.
  • 你的项目是什么版本的.Net ..?您是否尝试过关闭 VS IDE 并重新打开它..
  • 之前用的4.5改成4.5.1了,我已经关闭重新打开修复了还是不识别为关键字:(
  • 您打算使用什么Device 类?您希望在哪个命名空间中找到它?

标签: c# directx device direct3d


【解决方案1】:

设法解决了问题..供您参考,如果其他人遇到同样的问题。您必须将以下所有引用添加到项目中:(请注意,所有文件都可以在您的硬盘上的 c:\Windows\Microsoft.NET\DirectX 中找到托管代码) 1:文件夹 1.0.2902.0 中的 Microsoft.DirectX.dll 2 :文件夹 1.0.2902.0 中的 Microsoft.DirectX.Direct3D.dll 3:文件夹 1.0.2911.0 中的 MicrosoftMicrosoft.DirectX.Direct3DX.dll 感谢大家的帮助 :)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-09
    • 2015-03-13
    • 2020-05-19
    • 2015-03-07
    • 2021-06-18
    • 2021-10-19
    • 2011-01-30
    相关资源
    最近更新 更多