Ошибка "DllImport does not exist in the current context" - C#
Формулировка задачи:
проблема в чем. у меня есть библиотека написанная на C++
в приложении windowsforms я на событии нажатия клавиши пишу
а компилятор мне - DllImport does not exist in the current context
Runtime.InteropService прописал в using
сама dll описана так
[DllImport("Figures.dll")]namespace Figures
{
class Perimetr
{
static __declspec(dllexport) double GetPerimetr(double a,double b);
}
}Решение задачи: «Ошибка "DllImport does not exist in the current context"»
textual
Листинг программы
using System.Runtime.InteropServices;
namespace ConsoleApplication28
{
class Program
{
[DllImport( @"..." )]
static extern double GetPerimetr ( double a, double b );
static void
Main ( string[] args )
{
var t = GetPerimetr( 1.0, 2.0 );
return;
}
}
}