خرید بک لینک

gameover.blog.ir

رفع خطای The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference در سیشارپ.



دستور زیر رو در نظر بگیرید:

public partial class MainForm : Form
{

[DllImport("user32.dll", SetLastError = true)]
private static exte IntPtr FindWindow(string lpClassName, string lpWindowName);

public MainForm()



بعد اجرا خطای زیر دریافت میشه:

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


برای رفع این خطا باید دستور زیر رو بالای کدها بیارید:

using System.Runtime.InteropServices;

برچسب: نویسنده: ایلیا حیدری تاريخ: سه شنبه 1 فروردين 1396 ساعت: 21:43

صفحه بندی