You must Sign In to post a response.
  • Category: .NET

    What does static void mean in c#

    Please I will be very grateful if friends in the forum can help me understand what static void mean in C#, using a layman's language as I am a real novice in this technology right now. THANKS IN ANTICIPATION FOR YOUR ASSISTANCE
  • #761702

    Hi Benjamin Oluwasijii.

    Static is a keyword in c#, which can be used for methods, variables and classes.

    When ever we want to call a method with out creating object, then static comes in to picture.

    Every program should have an entry point, so Main()(method) will be assigned with static keyword like below.

    Public Static void Main()

    You can create objects and you can perform any task only after entering in to program. So static method will be called with out object creation and making you enter in to program.

    Void means that method is not going to return any value as result.
    It is called as return type. Return types can be void, int, string so on..

    Hope you understood.
    Choose as best answer if you are satisfied.


    Sridhar Thota.

    Sridhar Thota.
    Editor: DNS Forum.

  • #761703
    When you say 'static' it means, it is a special [optional] keyword that indicates that this method can be called without creating an instance of this class.
    And when you say 'Void' then it means void is the return type of this method, indicating that this method doesn't return anything. Methods must have a return type.

    hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #761708
    static means, you can call the function without creating object/instance of a class

    You need an entry point for your program. So we are using static for the Main method

    By Nathan
    Direction is important than speed

  • #761715
    Hello Benjamin Oluwasijii,

    static means that the method is associated with the class, not a specific instance (object) of that class. This means that you can call a static method without creating an object of the class.

    A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated.

    Example code :

    using System;

    static class MyClass
    public static int _value = 1;

    class Program
    static void Main()


    Hope you understand.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #761790

    Thanks for acknowledging, hope you have understood the concept.

    Select the category while posting the question according to you question type or c#.


    Sridhar Thota.
    If you learnt from defeat..
    You haven't really lost..

    Sridhar Thota.
    Editor: DNS Forum.

  • Sign In to post your comments