0

I have an application that is running multiple instances of itself on a single AppDomain, it is intended this way.

I have a couple of static properties that are initialized at the beginning and each is unique for the instance running it.

Now when I run first instance, everything is fine, but when I run second instance, it overrides properties of first instance.

How could I prevent that?

I can't use singleton pattern in such situation.

J. Doe
  • 905
  • 1
  • 10
  • 23
  • Is https://stackoverflow.com/questions/9806372/static-variable-instances-and-appdomains-what-is-happening relevant? – sgmoore Jan 14 '17 at 12:22

1 Answers1

0

In c# a static property is intended to be shared between all instances of the same class, regardless how many instances there are. Take as an example DateTime.Now

If the properties are intended to be unique between intances of the class you shouldn't use the staticmodifier.

sabotero
  • 4,265
  • 3
  • 28
  • 43