There is no argument given that corresponds to the required formal parameter - What does this mean?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-4















I am trying to call the method but for some reason it wont work
can someone tell me how to build a better method.



namespace ObjectsLifeTime
{
class Program
{
static void Main(string args)
{

Car myCar = new Car();
myCar.Make = "Ford";
myCar.Model = "Something";
myCar.Year = 2010;
myCar.Colour = "Blue";

Console.WriteLine(myCar.Stats());

}


class Car
{
public string Make { get; set; }
public string Model { get; set; }
public int Year { get; set; }
public string Colour { get; set; }

public static string Stats(Car car)
{
string restart = "false";
do
{
restart = "false";
Console.WriteLine("Press a to get the Make of the car");
Console.WriteLine("Press s to get the Model of the car");
Console.WriteLine("Press d to get the Year of the car");
Console.WriteLine("Press f to get the Colour of the car");
}
while (restart == "true");
string UserInput = Console.ReadLine();

if (UserInput == "a")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "s")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "d")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "f")
{
string UserOutput = car.Make;
return UserOutput;
}
else
{
restart = "true";
string UserOutput = "I did not understand that";
return UserOutput;
}
}
}
}
}









share|improve this question




















  • 1





    What if you explained more what you are doing and what exactly is failing, instead of repeating your text to meet up the character count requirement?

    – Patrick Hofman
    Jan 3 at 12:18











  • Console.WriteLine(myCar.Stats()); should likely be Console.WriteLine(Car.Stats(myCar));

    – mjwills
    Jan 3 at 12:26













  • Alternatively, if you don't want to make that change, instead change public static string Stats(Car car) { to public string Stats() { var car = this;.

    – mjwills
    Jan 3 at 12:27


















-4















I am trying to call the method but for some reason it wont work
can someone tell me how to build a better method.



namespace ObjectsLifeTime
{
class Program
{
static void Main(string args)
{

Car myCar = new Car();
myCar.Make = "Ford";
myCar.Model = "Something";
myCar.Year = 2010;
myCar.Colour = "Blue";

Console.WriteLine(myCar.Stats());

}


class Car
{
public string Make { get; set; }
public string Model { get; set; }
public int Year { get; set; }
public string Colour { get; set; }

public static string Stats(Car car)
{
string restart = "false";
do
{
restart = "false";
Console.WriteLine("Press a to get the Make of the car");
Console.WriteLine("Press s to get the Model of the car");
Console.WriteLine("Press d to get the Year of the car");
Console.WriteLine("Press f to get the Colour of the car");
}
while (restart == "true");
string UserInput = Console.ReadLine();

if (UserInput == "a")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "s")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "d")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "f")
{
string UserOutput = car.Make;
return UserOutput;
}
else
{
restart = "true";
string UserOutput = "I did not understand that";
return UserOutput;
}
}
}
}
}









share|improve this question




















  • 1





    What if you explained more what you are doing and what exactly is failing, instead of repeating your text to meet up the character count requirement?

    – Patrick Hofman
    Jan 3 at 12:18











  • Console.WriteLine(myCar.Stats()); should likely be Console.WriteLine(Car.Stats(myCar));

    – mjwills
    Jan 3 at 12:26













  • Alternatively, if you don't want to make that change, instead change public static string Stats(Car car) { to public string Stats() { var car = this;.

    – mjwills
    Jan 3 at 12:27














-4












-4








-4








I am trying to call the method but for some reason it wont work
can someone tell me how to build a better method.



namespace ObjectsLifeTime
{
class Program
{
static void Main(string args)
{

Car myCar = new Car();
myCar.Make = "Ford";
myCar.Model = "Something";
myCar.Year = 2010;
myCar.Colour = "Blue";

Console.WriteLine(myCar.Stats());

}


class Car
{
public string Make { get; set; }
public string Model { get; set; }
public int Year { get; set; }
public string Colour { get; set; }

public static string Stats(Car car)
{
string restart = "false";
do
{
restart = "false";
Console.WriteLine("Press a to get the Make of the car");
Console.WriteLine("Press s to get the Model of the car");
Console.WriteLine("Press d to get the Year of the car");
Console.WriteLine("Press f to get the Colour of the car");
}
while (restart == "true");
string UserInput = Console.ReadLine();

if (UserInput == "a")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "s")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "d")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "f")
{
string UserOutput = car.Make;
return UserOutput;
}
else
{
restart = "true";
string UserOutput = "I did not understand that";
return UserOutput;
}
}
}
}
}









share|improve this question
















I am trying to call the method but for some reason it wont work
can someone tell me how to build a better method.



namespace ObjectsLifeTime
{
class Program
{
static void Main(string args)
{

Car myCar = new Car();
myCar.Make = "Ford";
myCar.Model = "Something";
myCar.Year = 2010;
myCar.Colour = "Blue";

Console.WriteLine(myCar.Stats());

}


class Car
{
public string Make { get; set; }
public string Model { get; set; }
public int Year { get; set; }
public string Colour { get; set; }

public static string Stats(Car car)
{
string restart = "false";
do
{
restart = "false";
Console.WriteLine("Press a to get the Make of the car");
Console.WriteLine("Press s to get the Model of the car");
Console.WriteLine("Press d to get the Year of the car");
Console.WriteLine("Press f to get the Colour of the car");
}
while (restart == "true");
string UserInput = Console.ReadLine();

if (UserInput == "a")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "s")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "d")
{
string UserOutput = car.Make;
return UserOutput;
}
if (UserInput == "f")
{
string UserOutput = car.Make;
return UserOutput;
}
else
{
restart = "true";
string UserOutput = "I did not understand that";
return UserOutput;
}
}
}
}
}






c#






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 12:18









Mat

167k29323349




167k29323349










asked Jan 3 at 12:17









Ibraheem AyubIbraheem Ayub

81




81








  • 1





    What if you explained more what you are doing and what exactly is failing, instead of repeating your text to meet up the character count requirement?

    – Patrick Hofman
    Jan 3 at 12:18











  • Console.WriteLine(myCar.Stats()); should likely be Console.WriteLine(Car.Stats(myCar));

    – mjwills
    Jan 3 at 12:26













  • Alternatively, if you don't want to make that change, instead change public static string Stats(Car car) { to public string Stats() { var car = this;.

    – mjwills
    Jan 3 at 12:27














  • 1





    What if you explained more what you are doing and what exactly is failing, instead of repeating your text to meet up the character count requirement?

    – Patrick Hofman
    Jan 3 at 12:18











  • Console.WriteLine(myCar.Stats()); should likely be Console.WriteLine(Car.Stats(myCar));

    – mjwills
    Jan 3 at 12:26













  • Alternatively, if you don't want to make that change, instead change public static string Stats(Car car) { to public string Stats() { var car = this;.

    – mjwills
    Jan 3 at 12:27








1




1





What if you explained more what you are doing and what exactly is failing, instead of repeating your text to meet up the character count requirement?

– Patrick Hofman
Jan 3 at 12:18





What if you explained more what you are doing and what exactly is failing, instead of repeating your text to meet up the character count requirement?

– Patrick Hofman
Jan 3 at 12:18













Console.WriteLine(myCar.Stats()); should likely be Console.WriteLine(Car.Stats(myCar));

– mjwills
Jan 3 at 12:26







Console.WriteLine(myCar.Stats()); should likely be Console.WriteLine(Car.Stats(myCar));

– mjwills
Jan 3 at 12:26















Alternatively, if you don't want to make that change, instead change public static string Stats(Car car) { to public string Stats() { var car = this;.

– mjwills
Jan 3 at 12:27





Alternatively, if you don't want to make that change, instead change public static string Stats(Car car) { to public string Stats() { var car = this;.

– mjwills
Jan 3 at 12:27












3 Answers
3






active

oldest

votes


















-1














Following code should fix your issue



static void Main(string args)
{

Car myCar = new Car();
myCar.Make = "Ford";
myCar.Model = "Something";
myCar.Year = 2010;
myCar.Colour = "Blue";

Console.WriteLine(myCar.Stats());
Console.ReadKey();

}


public class Car
{
public string Make { get; set; }
public string Model { get; set; }
public int Year { get; set; }
public string Colour { get; set; }

public string Stats()
{
string restart = "false";
do
{
restart = "false";
Console.WriteLine("Press a to get the Make of the car");
Console.WriteLine("Press s to get the Model of the car");
Console.WriteLine("Press d to get the Year of the car");
Console.WriteLine("Press f to get the Colour of the car");
}
while (restart == "true");
string UserInput = Console.ReadLine();

if (UserInput == "a")
{
string UserOutput = Make;
return UserOutput;
}
if (UserInput == "s")
{
string UserOutput = Model;
return UserOutput;
}
if (UserInput == "d")
{
string UserOutput = Year.ToString();
return UserOutput;
}
if (UserInput == "f")
{
string UserOutput = Colour;
return UserOutput;
}
else
{
restart = "true";
string UserOutput = "I did not understand that";
return UserOutput;
}
}
}





share|improve this answer































    0














    Your Stats function is static.
    If you did it intentionally then you can access it via the class name Car.Stats()



    If you want to access it from each of the instances of the class Car then you need to make a regular function (remove the static...)






    share|improve this answer
























    • Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

      – Ibraheem Ayub
      Jan 4 at 13:17













    • docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

      – Idan Marko
      Jan 6 at 11:09



















    0














    In object oriented programming class is a template of something... like car.
    Car is the template but volvo for example is an instance of car.
    volvo was made out of the template of car but it is a single instance of it.
    all of the properties and function defined in the class car can be access threw volvo instance.
    when talking about static what we really want to say is that in some cases we would like to have the ability to use a function or a property with no relation to instance of the class.. let's suppose we have the class car.



    in the class car we create a static member named gasPrice



    public class Car 
    {
    public static double gasPrice =5;
    public string Make { get; set; }
    public string Model { get; set; }
    public int Year { get; set; }
    public string Colour { get; set; }
    }


    Now this property is shared between all the instances of car... volvo honda what ever... you cannot edit it only for one of them.
    The value of gasPrice set by the class level... now it צakes sense that we cant access it from one of the instances...
    We can access it only from the class name because it is related to the class!



    link for static explained



    Cheers!






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022141%2fthere-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-w%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      -1














      Following code should fix your issue



      static void Main(string args)
      {

      Car myCar = new Car();
      myCar.Make = "Ford";
      myCar.Model = "Something";
      myCar.Year = 2010;
      myCar.Colour = "Blue";

      Console.WriteLine(myCar.Stats());
      Console.ReadKey();

      }


      public class Car
      {
      public string Make { get; set; }
      public string Model { get; set; }
      public int Year { get; set; }
      public string Colour { get; set; }

      public string Stats()
      {
      string restart = "false";
      do
      {
      restart = "false";
      Console.WriteLine("Press a to get the Make of the car");
      Console.WriteLine("Press s to get the Model of the car");
      Console.WriteLine("Press d to get the Year of the car");
      Console.WriteLine("Press f to get the Colour of the car");
      }
      while (restart == "true");
      string UserInput = Console.ReadLine();

      if (UserInput == "a")
      {
      string UserOutput = Make;
      return UserOutput;
      }
      if (UserInput == "s")
      {
      string UserOutput = Model;
      return UserOutput;
      }
      if (UserInput == "d")
      {
      string UserOutput = Year.ToString();
      return UserOutput;
      }
      if (UserInput == "f")
      {
      string UserOutput = Colour;
      return UserOutput;
      }
      else
      {
      restart = "true";
      string UserOutput = "I did not understand that";
      return UserOutput;
      }
      }
      }





      share|improve this answer




























        -1














        Following code should fix your issue



        static void Main(string args)
        {

        Car myCar = new Car();
        myCar.Make = "Ford";
        myCar.Model = "Something";
        myCar.Year = 2010;
        myCar.Colour = "Blue";

        Console.WriteLine(myCar.Stats());
        Console.ReadKey();

        }


        public class Car
        {
        public string Make { get; set; }
        public string Model { get; set; }
        public int Year { get; set; }
        public string Colour { get; set; }

        public string Stats()
        {
        string restart = "false";
        do
        {
        restart = "false";
        Console.WriteLine("Press a to get the Make of the car");
        Console.WriteLine("Press s to get the Model of the car");
        Console.WriteLine("Press d to get the Year of the car");
        Console.WriteLine("Press f to get the Colour of the car");
        }
        while (restart == "true");
        string UserInput = Console.ReadLine();

        if (UserInput == "a")
        {
        string UserOutput = Make;
        return UserOutput;
        }
        if (UserInput == "s")
        {
        string UserOutput = Model;
        return UserOutput;
        }
        if (UserInput == "d")
        {
        string UserOutput = Year.ToString();
        return UserOutput;
        }
        if (UserInput == "f")
        {
        string UserOutput = Colour;
        return UserOutput;
        }
        else
        {
        restart = "true";
        string UserOutput = "I did not understand that";
        return UserOutput;
        }
        }
        }





        share|improve this answer


























          -1












          -1








          -1







          Following code should fix your issue



          static void Main(string args)
          {

          Car myCar = new Car();
          myCar.Make = "Ford";
          myCar.Model = "Something";
          myCar.Year = 2010;
          myCar.Colour = "Blue";

          Console.WriteLine(myCar.Stats());
          Console.ReadKey();

          }


          public class Car
          {
          public string Make { get; set; }
          public string Model { get; set; }
          public int Year { get; set; }
          public string Colour { get; set; }

          public string Stats()
          {
          string restart = "false";
          do
          {
          restart = "false";
          Console.WriteLine("Press a to get the Make of the car");
          Console.WriteLine("Press s to get the Model of the car");
          Console.WriteLine("Press d to get the Year of the car");
          Console.WriteLine("Press f to get the Colour of the car");
          }
          while (restart == "true");
          string UserInput = Console.ReadLine();

          if (UserInput == "a")
          {
          string UserOutput = Make;
          return UserOutput;
          }
          if (UserInput == "s")
          {
          string UserOutput = Model;
          return UserOutput;
          }
          if (UserInput == "d")
          {
          string UserOutput = Year.ToString();
          return UserOutput;
          }
          if (UserInput == "f")
          {
          string UserOutput = Colour;
          return UserOutput;
          }
          else
          {
          restart = "true";
          string UserOutput = "I did not understand that";
          return UserOutput;
          }
          }
          }





          share|improve this answer













          Following code should fix your issue



          static void Main(string args)
          {

          Car myCar = new Car();
          myCar.Make = "Ford";
          myCar.Model = "Something";
          myCar.Year = 2010;
          myCar.Colour = "Blue";

          Console.WriteLine(myCar.Stats());
          Console.ReadKey();

          }


          public class Car
          {
          public string Make { get; set; }
          public string Model { get; set; }
          public int Year { get; set; }
          public string Colour { get; set; }

          public string Stats()
          {
          string restart = "false";
          do
          {
          restart = "false";
          Console.WriteLine("Press a to get the Make of the car");
          Console.WriteLine("Press s to get the Model of the car");
          Console.WriteLine("Press d to get the Year of the car");
          Console.WriteLine("Press f to get the Colour of the car");
          }
          while (restart == "true");
          string UserInput = Console.ReadLine();

          if (UserInput == "a")
          {
          string UserOutput = Make;
          return UserOutput;
          }
          if (UserInput == "s")
          {
          string UserOutput = Model;
          return UserOutput;
          }
          if (UserInput == "d")
          {
          string UserOutput = Year.ToString();
          return UserOutput;
          }
          if (UserInput == "f")
          {
          string UserOutput = Colour;
          return UserOutput;
          }
          else
          {
          restart = "true";
          string UserOutput = "I did not understand that";
          return UserOutput;
          }
          }
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 12:29









          Prasanth V JPrasanth V J

          795928




          795928

























              0














              Your Stats function is static.
              If you did it intentionally then you can access it via the class name Car.Stats()



              If you want to access it from each of the instances of the class Car then you need to make a regular function (remove the static...)






              share|improve this answer
























              • Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

                – Ibraheem Ayub
                Jan 4 at 13:17













              • docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

                – Idan Marko
                Jan 6 at 11:09
















              0














              Your Stats function is static.
              If you did it intentionally then you can access it via the class name Car.Stats()



              If you want to access it from each of the instances of the class Car then you need to make a regular function (remove the static...)






              share|improve this answer
























              • Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

                – Ibraheem Ayub
                Jan 4 at 13:17













              • docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

                – Idan Marko
                Jan 6 at 11:09














              0












              0








              0







              Your Stats function is static.
              If you did it intentionally then you can access it via the class name Car.Stats()



              If you want to access it from each of the instances of the class Car then you need to make a regular function (remove the static...)






              share|improve this answer













              Your Stats function is static.
              If you did it intentionally then you can access it via the class name Car.Stats()



              If you want to access it from each of the instances of the class Car then you need to make a regular function (remove the static...)







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jan 3 at 12:57









              Idan MarkoIdan Marko

              92




              92













              • Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

                – Ibraheem Ayub
                Jan 4 at 13:17













              • docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

                – Idan Marko
                Jan 6 at 11:09



















              • Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

                – Ibraheem Ayub
                Jan 4 at 13:17













              • docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

                – Idan Marko
                Jan 6 at 11:09

















              Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

              – Ibraheem Ayub
              Jan 4 at 13:17







              Thanks That helped but what does static actually do? could you please put in an example - everywhere I've looked is too vague or over-complicated

              – Ibraheem Ayub
              Jan 4 at 13:17















              docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

              – Idan Marko
              Jan 6 at 11:09





              docs.microsoft.com/en-us/dotnet/csharp/language-reference/…

              – Idan Marko
              Jan 6 at 11:09











              0














              In object oriented programming class is a template of something... like car.
              Car is the template but volvo for example is an instance of car.
              volvo was made out of the template of car but it is a single instance of it.
              all of the properties and function defined in the class car can be access threw volvo instance.
              when talking about static what we really want to say is that in some cases we would like to have the ability to use a function or a property with no relation to instance of the class.. let's suppose we have the class car.



              in the class car we create a static member named gasPrice



              public class Car 
              {
              public static double gasPrice =5;
              public string Make { get; set; }
              public string Model { get; set; }
              public int Year { get; set; }
              public string Colour { get; set; }
              }


              Now this property is shared between all the instances of car... volvo honda what ever... you cannot edit it only for one of them.
              The value of gasPrice set by the class level... now it צakes sense that we cant access it from one of the instances...
              We can access it only from the class name because it is related to the class!



              link for static explained



              Cheers!






              share|improve this answer




























                0














                In object oriented programming class is a template of something... like car.
                Car is the template but volvo for example is an instance of car.
                volvo was made out of the template of car but it is a single instance of it.
                all of the properties and function defined in the class car can be access threw volvo instance.
                when talking about static what we really want to say is that in some cases we would like to have the ability to use a function or a property with no relation to instance of the class.. let's suppose we have the class car.



                in the class car we create a static member named gasPrice



                public class Car 
                {
                public static double gasPrice =5;
                public string Make { get; set; }
                public string Model { get; set; }
                public int Year { get; set; }
                public string Colour { get; set; }
                }


                Now this property is shared between all the instances of car... volvo honda what ever... you cannot edit it only for one of them.
                The value of gasPrice set by the class level... now it צakes sense that we cant access it from one of the instances...
                We can access it only from the class name because it is related to the class!



                link for static explained



                Cheers!






                share|improve this answer


























                  0












                  0








                  0







                  In object oriented programming class is a template of something... like car.
                  Car is the template but volvo for example is an instance of car.
                  volvo was made out of the template of car but it is a single instance of it.
                  all of the properties and function defined in the class car can be access threw volvo instance.
                  when talking about static what we really want to say is that in some cases we would like to have the ability to use a function or a property with no relation to instance of the class.. let's suppose we have the class car.



                  in the class car we create a static member named gasPrice



                  public class Car 
                  {
                  public static double gasPrice =5;
                  public string Make { get; set; }
                  public string Model { get; set; }
                  public int Year { get; set; }
                  public string Colour { get; set; }
                  }


                  Now this property is shared between all the instances of car... volvo honda what ever... you cannot edit it only for one of them.
                  The value of gasPrice set by the class level... now it צakes sense that we cant access it from one of the instances...
                  We can access it only from the class name because it is related to the class!



                  link for static explained



                  Cheers!






                  share|improve this answer













                  In object oriented programming class is a template of something... like car.
                  Car is the template but volvo for example is an instance of car.
                  volvo was made out of the template of car but it is a single instance of it.
                  all of the properties and function defined in the class car can be access threw volvo instance.
                  when talking about static what we really want to say is that in some cases we would like to have the ability to use a function or a property with no relation to instance of the class.. let's suppose we have the class car.



                  in the class car we create a static member named gasPrice



                  public class Car 
                  {
                  public static double gasPrice =5;
                  public string Make { get; set; }
                  public string Model { get; set; }
                  public int Year { get; set; }
                  public string Colour { get; set; }
                  }


                  Now this property is shared between all the instances of car... volvo honda what ever... you cannot edit it only for one of them.
                  The value of gasPrice set by the class level... now it צakes sense that we cant access it from one of the instances...
                  We can access it only from the class name because it is related to the class!



                  link for static explained



                  Cheers!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 5 at 16:18









                  Idan MarkoIdan Marko

                  92




                  92






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022141%2fthere-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-w%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith