Questions tagged [static-classes]

In object oriented programming a static class is a class whose members must be accessed without an instance of the class. Its members must be created as static.

In object oriented programming a static class is a class whose members must be accessed without an instance of the class. Its members must be created as static.

289 questions
-1
votes
1 answer

Does a static method in a non-static class make it a static class c#

Possibly a stupid question but I need to ask it anyway for my own context. I have a non-static class that has a static method and a non-static method. What happens to the class, is it now a static class and a non-static class, meaning there is a…
NNassar
  • 485
  • 5
  • 11
  • 25
-1
votes
2 answers

How can i get access to static method through variable?

Trying to get $class = 'MyClass'; $class::classname() - MyClass not found So, is it possible? Or are there other options? public function actionMultiUpdate($module) { if (isset($_REQUEST['multiedit']) && count($_REQUEST['multiedit'])) { …
Evgeny Musonov
  • 181
  • 3
  • 9
-1
votes
1 answer

Initializing properties of static class fails with null value exception

I have a static connection factory class and need to initialize the connection parameters from configuration namespace MyApp.Common.LinqToDB { public static class MyConnectionFactory { public static string Authority { get; set; } …
Tauqir
  • 155
  • 2
  • 10
-1
votes
1 answer

Should static classes have their first letter uppercased?

Generally speaking, (for any object-oriented programming language) conventionally, should the first letter of a static class be uppercased? As an example, in: // Example of a static class in JavaScript ES6 class myStaticClass { static…
Mystical
  • 2,505
  • 2
  • 24
  • 43
-1
votes
1 answer

issues in c# static class to deal with cookies

I want to create a static class that will deal with the cookies in my ASP.NET site. The class is written in c# and sits in App_code folder. The issue I have is that all the time, the updates in the cookie delete my previous value in the cookie, and…
Alon Galpe
  • 55
  • 3
  • 10
-1
votes
2 answers

Make sure that one static class is created before the other

I am developing a C#/WPF/MVVM/UWP app which uses a ViewModelLocator which looks like this: public class ViewModelLocator { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", …
Xaser
  • 2,066
  • 2
  • 22
  • 45
-1
votes
2 answers

PHP: is it possible to call a static class method from another static class?

Consider a static class (private constructor, only static methods & variables). Now the rough class definition would look like this: class A{ private function __construct(){} public static test(){}; } class B{ private function…
jave.web
  • 13,880
  • 12
  • 91
  • 125
-1
votes
2 answers

trouble writing a static version of the add and subtract methods (this is in java)

I need help writing a static version of the add and subtract methods. i have tried to do so but im not really sure if this is the right way and also my equals method is not working . When i compile my equals method it always prints false. public…
-1
votes
1 answer

Static Property with Windows Service

in my solution Explorer i have tow Project one for windows service BridgeWS and the other Project Vytru.Platform.Bridge.Configuration have a static class SharedData.cs My Problem : i want use this static property SharedData.DeviceList to get my…
Tarek Saied
  • 6,482
  • 20
  • 67
  • 111
-2
votes
2 answers

It is possible to save a variable's reference inside another variable in c#?

I am developing a little console game where you go through a dungeon. I'm trying to make a potion system for it, the idea is that when you use a potion, it changes a specific stat of the player. The stats of the player are stored in a static class…
-2
votes
2 answers

Declare a private static nested class with a public constructor Java?

How do I create an instance of a static private inner class with a public constructor? public class outerClass { private static class innerClass { E value; public innerClass(E e) { value = e; } }} I've tried this and…
user2208569
  • 109
  • 1
  • 11
-2
votes
1 answer

Best way to emulate inheritance of static classes

Background: I have a standard code list of string consts (in static classes) in a library that may be shared across several projects, run both internally and externally. (This library has a primary function that is not solely for storing these…
CarenRose
  • 1,266
  • 1
  • 12
  • 24
-2
votes
1 answer

Static Objects are not getting stored in HashMap.!

I am trying to create a Map with key as a String and Value as a static class. But when I am printing the data, it only stores the last key-value pair. Can someone help me with this. import java.util.HashMap; import java.util.Map; public class…
-2
votes
1 answer

Static class vs. static variables best practice

I use WinForms. In this app I can show a VIEW MODE and an EDIT MODE, both these modes will display a different panel (Panel ViewPanel, Panel EditPanel). They both are only created ONCE, and they both contain other controls.. (Labels,…
Budapest
  • 105
  • 7
-2
votes
1 answer

Send progress information from static class to main class

My main class uses several static classes to fetch data from internet. Sometimes there are lots of data to fetch, and that takes some time. Is there any way for static class to report its progress to main class? Not only percent, but text…
darx
  • 1,417
  • 1
  • 11
  • 25
1 2 3
19
20