using or Import System.Runtime.InteropServices seehttp://archive.devx.com/dotnet/discussions/040902/cominterop.asp

解决方案 »

  1.   

    这是个API函数,请参阅.net调用API的文档。而且.net已经对其进行升级。
      

  2.   

    能不能给的详细一点
    using or Import System.Runtime.InteropServices http://archive.devx.com/dotnet/discussions/040902/cominterop.asp
    好像不行也
      

  3.   

    Test.ini:[textvalues]
    1=item1
    2=item2
    3=item3[intvalues]
    1=101
    2=102
    3=103TestIni.cs:
    using System;
    using System.Text;
    using System.Runtime.InteropServices;class TestINI
    {   [DllImport("KERNEL32.DLL")]
       protected internal static extern int GetPrivateProfileString(string lpAppName, 
       string lpKeyName, string lpDefault, 
       StringBuilder lpReturnedString, int nSize, 
       string lpFileName);  public static void Main()
      {
      StringBuilder buffer = new StringBuilder(256);
    int bufLen = GetPrivateProfileString("textvalues", "1", "", buffer, buffer.Capacity, @"e:\labs\csharp\Test.ini");
    Console.WriteLine(buffer.ToString());  }
    }by the way, you probably want to consider to use XML files instead