Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:32:36+00:00 2026-06-11T10:32:36+00:00

I use Resharper tool in visual studio Consider a very simple class written below.

  • 0

I use Resharper tool in visual studio

Consider a very simple class written below.

class Test()
{

   //constructors do not have any return type.   
   Test()
   {
      System.Console.WriteLine("Hello World!");
   } 

   static Test()
   {
        System.Console.WriteLine("Hello World in Static constructors");
   }

   public void A()
   {
      System.Console.WriteLine("A simple function in a class");
   }

}


class Program
  {
    static void Main(string[] args)
    {
        var asa = new Test(); //Implicitly Typed local variables.
        asa.A();

    }
}

Using var (the compiler has to infer the type of the variable from the expression on
the right side of the initialization statement).

I have some clarification questions and they are below.

  1. Extra burden to compiler?
  2. How many constructors a class can have?
  3. Why is static constructor called first ? (I checked out by putting a breakpoint?)
  4. Why not Test asa = new Test(); is not preferred by Resharper?
  5. Is it really a good idea to use Resharper first as a beginner? (Myself being a newbie to C and .net programming!)

Thanks in Advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:32:38+00:00Added an answer on June 11, 2026 at 10:32 am
    1. Any extra burden to the compiler is basically irrelevant – it should not be part of your decision about whether or not to use var. As noted in comments, it may well require slightly more work for the compiler when you use explicitly declared variable… but again, it’s not going to be significant.

    2. A class can have any number of constructors… although it will become unwieldy pretty quickly.

    3. The static constructor will be called once, before the first use of the class (whether that’s via a static method or a constructor call). Read the C# spec for more details – section 10.12 of the C# 5 spec includes:

      The static constructor for a closed class type executes at most once in a given application domain. The execution of a static constructor is triggered by the first of the following events to occur within an application domain:

      • An instance of the class type is created.
      • Any of the static members of the class type are referenced.
    4. You can configure ReSharper to suggest alternatives, or treat them as warnings, etc. Make it work however you think it should, on this front.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using several months ReSharper 4.5 It's very powerfull tool but use a
Recently ReSharper suggested in my Visual Studio 2010 solution that I could use optional
If I have namespace with two classes. I want to use class from one
I have an MVC2 application and use ReSharper 6.1 - I've heavily customised the
I use the code reformatting tool in ReSharper to get some standard format on
In Visual Studio 2008's Options > Text Editor > C# > Formatting, I have
I need to use the ReSharper Unit Test Runner to run my MSTest Unit
When using Resharper or CodeRush Express in the Visual Studio 2008 IDE, these tools
I use Resharper at work. Some of my colleagues do not. When I open
I use ReSharper's code cleanup all the time, but sometimes I have code formatted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.