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 6391947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:45:01+00:00 2026-05-25T03:45:01+00:00

I have the class below. _commandLine variable is declared as static. Does this variable

  • 0

I have the class below. _commandLine variable is declared as static. Does this variable will be shared between WkHtml class instances?

p.s. It would be cool to have Tool which would show such information in VS. For example developer select variable and get information about variable, is variable shared between classes, is it thread safe and etc.

public class WkHtml
{
    private static string _commandLine;

    public void AddCommandLine(object value)
    {
        AddCommandLine("{0}", value);
    }

    public void AddCmdWithCond(string value, bool condition, object compareValue)
    {
        AddCmdWithCond(value, condition, compareValue, "");
    }

    public void AddCmdWithCond(string value, bool condition, object compareValue, string defaultValue)
    {
        if (compareValue != null && !string.IsNullOrEmpty(compareValue.ToString()) && Helpers.GetBool(compareValue) == condition)
            AddCommandLine("{0}", value);
        else
            if (defaultValue != null)
                AddCommandLine("{0}", defaultValue);
    }

    public void AddCommandLine(object parameter, object value, object defaultValue)
    {
        if (value == null || string.IsNullOrEmpty(value.ToString()))
        {
            value = defaultValue;
        }
        AddCommandLine(parameter, value);
    }

    public void AddCommandLine(object parameter, object value)
    {
        if (value == null || string.IsNullOrEmpty(value.ToString())) return;
        _commandLine = _commandLine + string.Format(parameter.ToString(), value) + " ";
    }

    public string GetCommandLine
    {
        get { return _commandLine; }
    }

}
  • 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-05-25T03:45:01+00:00Added an answer on May 25, 2026 at 3:45 am

    static variables are shared between all class instances.

    I don’t see any reason to why you should declare it as static?

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

Sidebar

Related Questions

I have a class that I am using below. And I am using this
I have a class (below): class InstrumentChange(object): '''This class acts as the DTO object
I have this class/object below: public class Person { public string FirstName; public string
I have a template class like below. template<int S> class A { private: char
Code below is working well as long as I have class ClassSameAssembly in same
I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other
I have a class with a set of properties As given below. class ContactInfo
I have three model classes that look as below: class Model(models.Model): model = models.CharField(max_length=20,
I have a data structure which is as given below: class File { public
I have a question, here are two classes below: class Base{ public: virtual void

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.