c# Programming Glossary: instance
What is the correct way to create a single instance application? http://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-application is the correct way to create a single instance application Using C# and WPF under .net rather than WindowsForms.. to create an application that can only be run as a single instance I know it has something to do with some mythical thing called.. are. The code needs to also inform the already running instance that the user tried to start a second one and maybe also pass..
Dependency Inject (DI) “friendly” library http://stackoverflow.com/questions/2045904/dependency-inject-di-friendly-library how the Service class guarantees its invariants. Once an instance is created the dependency is guaranteed to be available because..
When do you use the “this” keyword? [closed] http://stackoverflow.com/questions/23250/when-do-you-use-the-this-keyword value . To invoke an extension method on the current instance To cast itself to another type You can avoid the first usage..
Why are mutable structs evil? http://stackoverflow.com/questions/441309/why-are-mutable-structs-evil change it you have to consciously do it by creating a new instance of the struct with the modified data. not a copy share improve..
Case insensitive 'Contains(string)' http://stackoverflow.com/questions/444798/case-insensitive-containsstring word CompareOptions.IgnoreCase Where culture is the instance of CultureInfo describing the language that the text is written..
Casting vs using the 'as' keyword in the CLR http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr between the two. If randomObject really should be an instance of TargetType i.e. if it's not that means there's a bug then.. TargetType randomObject If randomObject might be an instance of TargetType and TargetType is a reference type then use code.. with convertedRandomObject If randomObject might be an instance of TargetType and TargetType is a value type then we can't use..
When to use struct in C#? http://stackoverflow.com/questions/521298/when-to-use-struct-in-c found Consider defining a structure instead of a class if instances of the type are small and commonly short lived or are commonly.. to primitive types integer double and so on . It has an instance size smaller than 16 bytes. It is immutable. It will not have.. of requirement to keep structs immutable or maintaining an instance size of only 16 bytes or less Nothing in the structs above is..
Difference between Property and Field in C# 3.0+ http://stackoverflow.com/questions/653536/difference-between-property-and-field-in-c-sharp-3-0 share improve this question Encapsulation. In the second instance you've just defined a variable in the first there is a getter..
Random number generator only generating one random number http://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number same value lots of times. You should keep a single Random instance and keep using Next on the same instance. Function to get random.. a single Random instance and keep using Next on the same instance. Function to get random number private static readonly Random.. Next is going to change the internal state of the Random instance. If we do that at the same time from multiple threads you could..
Deep cloning objects in C# http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp being copied. typeparam param name source The object instance to copy. param returns The copied object. returns public static..
What's a good threadsafe singleton generic template pattern in C# http://stackoverflow.com/questions/100081/whats-a-good-threadsafe-singleton-generic-template-pattern-in-c-sharp private static volatile T _instance null public static T Instance get if _instance null lock _syncobj if _instance null..
Are static methods thread safe http://stackoverflow.com/questions/1090650/are-static-methods-thread-safe of any .NET BCL static methods which aren't thread safe. Instance methods are often not thread safe because the typical pattern..
Open link in new TAB (WebBrowser Control) http://stackoverflow.com/questions/1286746/open-link-in-new-tab-webbrowser-control event while providing public access to the ActiveX Instance for passing into ppDisp in new tabs . This has been done before..
Method can be made static, but should it? http://stackoverflow.com/questions/169378/method-can-be-made-static-but-should-it share improve this question Static methods versus Instance methods 10.2.5 Static and instance members of the C# Language..
Are static class instances unique to a request or a server in ASP.NET? http://stackoverflow.com/questions/194999/are-static-class-instances-unique-to-a-request-or-a-server-in-asp-net public static GloballyAccessibleClass Instance get IDictionary items HttpContext.Current.Items if items.Contains.. items HttpContext.Current.Items if items.Contains TheInstance items TheInstance new GloballyAccessibleClass return items.. if items.Contains TheInstance items TheInstance new GloballyAccessibleClass return items TheInstance as GloballyAccessibleClass..
The need for volatile modifier in double checked locking in .NET http://stackoverflow.com/questions/1964731/the-need-for-volatile-modifier-in-double-checked-locking-in-net new Object private Singleton public static Singleton Instance get if instance null lock syncRoot if instance null instance..
The underlying provider failed on Open http://stackoverflow.com/questions/2475008/the-underlying-provider-failed-on-open NData.mdf Integrated Security True Connect Timeout 30 User Instance True MultipleActiveResultSets True quot providerName System.Data.EntityClient.. NData Integrated Security True Connect Timeout 30 User Instance True MultipleActiveResultSets True quot providerName System.Data.EntityClient..
Singleton by Jon Skeet clarification http://stackoverflow.com/questions/2550925/singleton-by-jon-skeet-clarification sealed class Singleton Singleton public static Singleton Instance get return Nested.instance class Nested Explicit static.. Singleton instance new Singleton public static Singleton Instance get return instance static Singleton private Singleton share..
Get name of property as a string http://stackoverflow.com/questions/2820660/get-name-of-property-as-a-string string name GetPropertyName SomeClass.SomeProperty Instance Property string name GetPropertyName someObject.SomeProperty..
How's memory allocated for a static variable? http://stackoverflow.com/questions/337019/hows-memory-allocated-for-a-static-variable staticVariable Static Variable string instanceVariable Instance Variable public Main The instanceVariable will be stored inside..
Calculating Bandwidth http://stackoverflow.com/questions/442409/calculating-bandwidth Bytes Sent bytesSentPerformanceCounter.InstanceName GetInstanceName bytesSentPerformanceCounter.ReadOnly true.. Bytes Sent bytesSentPerformanceCounter.InstanceName GetInstanceName bytesSentPerformanceCounter.ReadOnly true float bytesSent.. .... private static string GetInstanceName Used Reflector to find the correct formatting string assemblyName..
There is a Default instance of form in VB.Net but not in C#, WHY? http://stackoverflow.com/questions/4698538/there-is-a-default-instance-of-form-in-vb-net-but-not-in-c-why the default instance of the form. Now where this Default Instance come from why can't C# have a equivalent method to this. Also.. in Designer so how can the names be same for both the Instance and class name. If Form1 is Class then there is no Static Shared.. InitializeComponent instance this public static Form2 Instance get if Instance null instance new Form2 instance.FormClosed..
Is the C# static constructor thread safe? http://stackoverflow.com/questions/7095/is-the-c-sharp-static-constructor-thread-safe Singleton instance new Singleton public static Singleton Instance get return instance c# multithreading singleton share improve..
Run single instance of an application using Mutex http://stackoverflow.com/questions/819773/run-single-instance-of-an-application-using-mutex else _mut.Close MessageBox.Show Instance already running c# mutex share improve this question ..
Prevent multiple instances of a given app in .NET? http://stackoverflow.com/questions/93989/prevent-multiple-instances-of-a-given-app-in-net Global appGuid if mutex.WaitOne 0 false MessageBox.Show Instance already running return Application.Run new Form1 private static..
|