c# Programming Glossary: lots
Most elegant way to generate prime numbers http://stackoverflow.com/questions/1042902/most-elegant-way-to-generate-prime-numbers Use LINQ to lazily generate the list of primes Maghis Put lots of primes in a text file and read them in when necessary darin..
How to make Databinding type safe and support refactoring http://stackoverflow.com/questions/1329138/how-to-make-databinding-type-safe-and-support-refactoring is a problem in WinForm Asp.net and WPF and most likely lots of other systems I have now found workarounds for nameof operator..
Enum type constraints in C# [duplicate] http://stackoverflow.com/questions/1331739/enum-type-constraints-in-c-sharp There's no particularly unusual reason why not we have lots of other things to do limited budgets and this one has never..
How can I easily convert DataReader to List<T>? [duplicate] http://stackoverflow.com/questions/1464883/how-can-i-easily-convert-datareader-to-listt to have œup your sleeves p If you every needed too write lots of IDataReader loops you will see the benefit of reducing the..
Performance surprise with “as” and nullable types http://stackoverflow.com/questions/1583050/performance-surprise-with-as-and-nullable-types This is a general purpose function for any value type lots of code there to check types. And the value is copied. Hard..
Using CookieContainer with WebClient class http://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class functionalty. Before I knew about this option I wrote lots of really painful code at the HttpWebRequest layer because WebClient..
Does using “new” on a strict allocate it on the heap or stack? http://stackoverflow.com/questions/203695/does-using-new-on-a-strict-allocate-it-on-the-heap-or-stack mscorlib System.Guid field As you can see there are lots of different instructions used for calling the constructor newobj..
Is it abusive to use IDisposable and “using” as a means for getting “scoped behavior” for exception safety? http://stackoverflow.com/questions/2101524/is-it-abusive-to-use-idisposable-and-using-as-a-means-for-getting-scoped-beha why that interface implies IDisposable. There are lots of other alternatives to doing this but ultimately I can't think..
Creating Wizards for Windows Forms in C# [closed] http://stackoverflow.com/questions/2340566/creating-wizards-for-windows-forms-in-c-sharp each wizard step is possible but very awkward. And ugly lots of flickering when the user changes the step. Making each step..
When to Use Static Classes in C# http://stackoverflow.com/questions/241339/when-to-use-static-classes-in-c-sharp attempt at creating a service oriented architecture lots of stateless services that just did their job and nothing else...
How to avoid Dependency Injection constructor madness? http://stackoverflow.com/questions/2420193/how-to-avoid-dependency-injection-constructor-madness Locator it's more or less a glorified static factory. For lots of reasons I consider this an anti pattern . One of the wonderful..
If vs. Switch Speed http://stackoverflow.com/questions/445067/if-vs-switch-speed codes as values. This has asymptotic better runtime than lots of chained if tests and is actually faster even for relatively..
Cross-thread operation not valid [duplicate] http://stackoverflow.com/questions/5037470/cross-thread-operation-not-valid do really hard work and then... listView1.Items.Add lots of items lots more UI work t.Start I don't care when or how.. hard work and then... listView1.Items.Add lots of items lots more UI work t.Start I don't care when or how the Thread finishes..
Convert DataTable to generic List? http://stackoverflow.com/questions/545328/convert-datatable-to-generic-list do... something like below. Note that if I was doing this lots I'd either switch to HyperDescriptor or if .NET 3.5 was an option..
In C#, how to check if a TCP port is available? http://stackoverflow.com/questions/570098/in-c-how-to-check-if-a-tcp-port-is-available that means you're checking open TCP ports. There are lots of good objects available in the System.Net.NetworkInformation..
Calling null on a class vs Dispose() http://stackoverflow.com/questions/574019/calling-null-on-a-class-vs-dispose around finalizers and IDisposable co written with lots of smart folk which are worth reading. It's worth being aware..
Best way to copy the entire contents of a directory in C# http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c-sharp to be a way to do this using System.IO classes without lots of recursion. There is a method in VB that we can use if we..
Random number generator only generating one random number http://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number This means that in a tight loop you get the same value lots of times. You should keep a single Random instance and keep..
Why is Multiple Inheritance not allowed in Java or C#? http://stackoverflow.com/questions/995255/why-is-multiple-inheritance-not-allowed-in-java-or-c comparisons verifiability reflection generics and probably lots of other places. You can read the full article here. For Java..
Where clause on collection http://stackoverflow.com/questions/13903314/where-clause-on-collection
View Models and dependency injection http://stackoverflow.com/questions/14131804/view-models-and-dependency-injection doesn't mean it will always be the case. The end result Lots of classes a downside granted but minimal repetition of code..
Error logging in C# http://stackoverflow.com/questions/147557/error-logging-in-c-sharp reporting error logging share improve this question Lots of log4net advocates here so I'm sure this will be ignored but..
Simple animation using C#/Windows Forms http://stackoverflow.com/questions/188349/simple-animation-using-c-windows-forms the PaintEventArgs was slow and they weren't kidding. Lots of flickering went away when I abandoned this. Skip the OnPaint..
Creating Wizards for Windows Forms in C# [closed] http://stackoverflow.com/questions/2340566/creating-wizards-for-windows-forms-in-c-sharp ravi c# winforms wizard share improve this question Lots of ways to do it. Creating a form for each wizard step is possible..
VB.NET vs. C#.NET? [closed] http://stackoverflow.com/questions/2434825/vb-net-vs-c-net AJAX and Silverlight development Database SQL access Lots of event handling Sync and Async events My question is Given..
How to Store data without using Database and how to retrieve them? http://stackoverflow.com/questions/2606959/how-to-store-data-without-using-database-and-how-to-retrieve-them so on. c# .net winforms share improve this question Lots of people have been talking about XML it's a good idea. However..
Winforms vs WPF http://stackoverflow.com/questions/2703681/winforms-vs-wpf full runtime . And don't forget mobile a huge growth area. Lots of people writing non browser apps for those. Oh and consoles..
Ways to access a 32bit DLL from a 64bit exe http://stackoverflow.com/questions/2804818/ways-to-access-a-32bit-dll-from-a-64bit-exe so response time is critical despite low volume. Lots of sending receiving single primitives. Ideally I would host..
What is the best practice for “Copy Local” and with project references? http://stackoverflow.com/questions/280751/what-is-the-best-practice-for-copy-local-and-with-project-references off What do other people with large systems do FOLLOWUP Lots of responses suggest breaking up the build into smaller .sln..
Set DllImport attribute dynamically http://stackoverflow.com/questions/2818011/set-dllimport-attribute-dynamically extern IntPtr GetProcAddress IntPtr hModule string name Lots of ways to get this wrong of course. Do note that you have to..
Lots of first chance Microsoft.CSharp.RuntimeBinderExceptions thrown when dealing with dynamics http://stackoverflow.com/questions/2954531/lots-of-first-chance-microsoft-csharp-runtimebinderexceptions-thrown-when-dealin of first chance Microsoft.CSharp.RuntimeBinderExceptions thrown..
How do you validate an object's internal state? http://stackoverflow.com/questions/343605/how-do-you-validate-an-objects-internal-state but test builds sail through broken invariants. Lots of strange behaviour bugs get filed where in fact a single bug..
How to detect the character encoding of a text file? http://stackoverflow.com/questions/4520184/how-to-detect-the-character-encoding-of-a-text-file range. UTF 8 BOM is EF BB BF. But you can't rely on this. Lots of UTF 8 files don't have a BOM especially if they originated..
Extending the list of supported image formats in GDI+ http://stackoverflow.com/questions/455018/extending-the-list-of-supported-image-formats-in-gdi method to find it's just a wrapper for gdiplus.dll Lots of Google searches which seem to provide lots of cases of using..
How to print the current Stack Trace in .NET without any exception? http://stackoverflow.com/questions/531695/how-to-print-the-current-stack-trace-in-net-without-any-exception Have a look at the System.Diagnostics namespace. Lots of goodies in there System.Diagnostics.StackTrace t new System.Diagnostics.StackTrace..
Unable to serialize the session state http://stackoverflow.com/questions/5889240/unable-to-serialize-the-session-state be met then. Serializable public partial class Gebruiker Lots of stuff EDIT 2 Thomas your Gebruiker class probably has a definition..
Why doesn't C# have support for first pass exception filtering? http://stackoverflow.com/questions/602066/why-doesnt-c-sharp-have-support-for-first-pass-exception-filtering a problem is that there is code in the BCL that does this. Lots of people have blogged about doing it but they rarely if ever..
How to Implement Password Resets? http://stackoverflow.com/questions/664673/how-to-implement-password-resets asp.net mvc security share improve this question Lots of good answers here I wont bother repeating it all... Except..
Writing large number of records (bulk insert) to Access in .NET/C# http://stackoverflow.com/questions/7070011/writing-large-number-of-records-bulk-insert-to-access-in-net-c return elapsedTimeInSeconds Finally I tried DAO. Lots of sites out there give huge warnings about using DAO. However..
|