Can a single process with multiple threads cause a static class to be created more than once?
If I just need a simple construct can I use a static class, or do I have to resort to a singleton?
Can a single process with multiple threads cause a static class to be created more than once?
If I just need a simple construct can I use a static class, or do I have to resort to a singleton?
Can a single process with multiple threads cause a static class to be created more than once?
No, multiple threads will all point to the same static class.
If I just need a simple construct can I use a static class, or do I have to resort to a singleton?
Don't really understand your question. But general you use Singleton when you need to have global data access. You can get the same thing with static class with static members. But that makes the code uglier because there are just too many statics keywords and makes your life difficult should you want to discard the global access strategy and use a more OOP approach.
Singleton, however, is a much preferred method, compared to static class.
Edit: You may want to read this: static classes are not thread-safe
You can't create an instance of a static class... But a static instance of a normal class will be the same over all threads
I think when you say "created" you really mean "instantiated," instantiation being the creation of an object of that class. Static classes are never instantiated. They are essentially a collection of global variables and functions.
One instance of each static member variable is created at runtime, and they will be shared among all threads.
Yes a static class can act as a singleton-like construct. All the static members it contains will only exists once - but per AppDomain (just keep in mind that one process can have multiple (isolated) .NET AppDomains).
Can a single process with multiple threads cause a static class to be created more than once?
Irrespective of the number of threads, the only way to get more than one instance of static .NET class (members) in a process is by making new AppDomains. Each AppDomain will then have one instance of the static class (members).
edit:
I should add that the number of threads in a process and the number of AppDomains are separate as well. A single-threaded process create any number of AppDomains if it wished. Also, it is only up to program flow whether any extra threads call into additional AppDomains. This could create a situation where multiple threads are accessing more than one instance of a static class, but it won't happen unless you explicitly create this scenario yourself.
If I just need a simple construct can I use a static class, or do I have to resort to a singleton?
It seems unclear what you're trying to ask here. Static class members represent singletons by concept. If you're asking whether this is a good method of creating a simple construct, the answer is maybe. It depends on what your needs are. Most will argue that you should just use a regular class definition and just make one instance.
Given your two questions in conjunction, I would speculate that maybe you are asking if you can create only one instance as a singleton by using a static class. The answer is yes, as you won't automatically have new AppDomains unless your code explicitly creates one or if you import code that creates new AppDomains using your assemblies.
Can a single process with multiple threads cause a static class to be created more than once?
Yes you can, though it's somewhat unusual to do (or even want to). It requires either a separate AppDomain, or use of ThreadStaticAttribute. Either of those will give you a separate instance that does not share state with other static instances.
If I just need a simple construct can I use a static class, or do I have to resort to a singleton?
You can use either. A singleton allows you to use a non-static class like a static, and gives you some additional flexibility in managing lifetime.