I'm trying to import a dll to my C# project using DllImport as follows:
[DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key,string val,string filePath); Also, I have added the namespace System.Runtime.InteropServices:
using System.Runtime.InteropServices; Still, I'm getting an error: "The name 'DllImport' does not exist in the current context"
Is there a limitation on where in a class you can import a dll?