L'appel d'une méthode Statique en C#

Comment dois-je appeler une méthode statique? Je veux appeler ce à partir d'une classe que j'ai créé, je veux obtenir l'emplacement de la propriété intellectuelle. J'ai déclaré, mais ce que j'ai besoin de faire est d'appeler la méthode... comme static...

Pour être honnête avec vous, je suis assez confus ici, ai-je besoin d'instancier address, city, etc.?

Je l'ai fait jusqu'à présent;

LocationTools.cs

public static class LocationTools
    {
        public static void GetLocationFromIP(string address, out string city, out string region, out string country, out double? latitude, out double? longitude)
        {

La maison.cs

   public string IPAPIKey
    {
       get
        {
            return WebConfigurationManager.AppSettings["IPAPIKey"];
        }
    }

    ////To get the ip address of the machine and not the proxy use the following code
    static void GetLocationFromIP()
    {
        string strIPAddress = Request.UserHostAddress.ToString();
        strIPAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

        if (strIPAddress == null || strIPAddress == "")
        {
            strIPAddress = Request.ServerVariables["REMOTE_ADDR"].ToString();
        }
    }
}

}

qu'avez-vous essayer? utilisez simplement LocationTools.GetLocationFromIP(...);

OriginalL'auteur MJCoder | 2011-10-17