4

誰かが私がこのメッセージと何をしなければならないかを提案できますか?

CA1060 P/InvokesをNativeMethodsクラスに移動するこれはP/Invokeメソッドであるため、「UControl.InternetGetConnectedState(out int、int)」は、NativeMethods、SafeNativeMethods、またはUnsafeNativeMethodsという名前のクラスで定義する必要があります。メガ。UControl.xaml.cs 33

コード:

namespace Mega
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UControl 
    { 
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int description, int reservedValue);

ありがとう!

4

2 に答える 2

3

おー!

答えを見つけた

https://msdn.microsoft.com/library/ms182161.aspx

using System;
using System.Runtime.InteropServices;

    namespace DesignLibrary
    {
    // Violates rule: MovePInvokesToNativeMethodsClass.
        internal class UnmanagedApi
        {
            [DllImport("kernel32.dll")]
            internal static extern bool RemoveDirectory(string name);
        }
    }
于 2012-11-27T18:24:40.393 に答える