I’m coming from an obj-c background looking at some C# code. In a partial subclass of Window, I see this at the top of the code:
public partial class MyMessage : Window
{
private static object _messageLock = new object();
private static MyMessage _f = new MyMessage();
What are these types of member variables used for? I know you can create a static variable for a class so that it is used for the whole class (the classic example being some int count variable that will increment every time the class is instantiated in order to keep track of how many objects of that class are instantiated). In this case, I am not sure what it means.
Thanks.
This looks like the class creates a Singleton of type
MyMessageand then controls access to it using a lock on themessageLockvariable – hard to verify though without the full code.