0

I am new to Windows 8 development, my question is: how do I use C# Singleton in Javascript app? I am using the Static Initialization (http://msdn.microsoft.com/en-us/library/ff650316.aspx) in my C# class. MyClass.Instance (which returns the singleton instance) is undefined when I call it in Javascript. Thanks.

EDIT: I have a C# class which is Singleton, and I am trying to use it with my Javascript Windows 8 App, I am not trying to implement Singleton in Javascript.

2
  • Check out this: stackoverflow.com/questions/1635800/… Commented May 11, 2013 at 19:28
  • this is not what I am looking for. I am trying to use C# singleton class in javascript. I don't even know if it is possible. Commented May 12, 2013 at 9:13

1 Answer 1

0

Language projection will slightly change the name of properties to conform to the patterns used in the consuming language. So when you define a property MyClass::Instance in C#, you should have MyClass.instance (lowercase 'i') in JavaScript.

Also, you can browse the available functions and properties in the JavaScript debugger (using Shift+F9 and entering "MyClass" for example is one way).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.