c# Programming Glossary: think
How to check for file lock? http://stackoverflow.com/questions/1304/how-to-check-for-file-lock share improve this question No unfortunately and if you think about it that information would be worthless anyway since the..
String vs string in C# [duplicate] http://stackoverflow.com/questions/215255/string-vs-string-in-c-sharp It's like int vs. System.Int32 . As far as guidelines I think it's generally recommended to use string any time you're referring.. referring to an object. e.g. string place world Likewise I think it's generally recommended to use String if you need to refer..
Creating a byte array from a stream http://stackoverflow.com/questions/221925/creating-a-byte-array-from-a-stream data in an array. If you know the size to start with or think you know the size without being sure you can construct the MemoryStream..
Best Practice: Initialize class fields in constructor or at declaration? http://stackoverflow.com/questions/24551/best-practice-initialize-class-fields-in-constructor-or-at-declaration Roll ... I'm really curious what some of you veterans think is the best practice.. I want to be consistent and stick to..
C# Captured Variable In Loop http://stackoverflow.com/questions/271440/c-sharp-captured-variable-in-loop 5 int copy variable actions.Add copy 2 variable You can think of it as if the C# compiler creates a new local variable every..
How to detect Windows 64-bit platform with .NET? http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net you have to first check if running in a 64 bit process I think in .NET you can do so by checking IntPtr.Size and if you are..
Casting vs using the 'as' keyword in the CLR http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr makes sense. Sorry for the bad example it is all I could think of... Update What is in general the preferred method I had a.. c# casting clr share improve this question I don't think any of the answers so far at the time of starting this answer.. Note currently this is actually slower than is cast . I think it's more elegant and consistent but there we go. If you really..
Proper use of the IDisposable interface http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface are obvious and just detail Microsoft's implementation. I think every programmer who has ever dealt with objects or COM should..
What is the best workaround for the WCF client `using` block issue? http://stackoverflow.com/questions/573872/what-is-the-best-workaround-for-the-wcf-client-using-block-issue e ... client.Abort throw Compared to the using block I think that's ugly. And a lot of code to write each time you need a.. orderService.PlaceOrder request That's not bad but I don't think it's as expressive and easily understandable as the using block... question Actually although I blogged see Luke's answer I think this see alternative link is better than my IDisposable wrapper...
What's the difference between String and string? http://stackoverflow.com/questions/7074/whats-the-difference-between-string-and-string It's like int vs. System.Int32 . As far as guidelines I think it's generally recommended to use string any time you're referring.. referring to an object. e.g. string place world Likewise I think it's generally recommended to use String if you need to refer..
Is there a reason for C#'s reuse of the variable in a foreach? http://stackoverflow.com/questions/8898925/is-there-a-reason-for-cs-reuse-of-the-variable-in-a-foreach loop and under normal circumstances the only reason I can think of for doing this is if you plan to use the variable outside.. variable outside the loop consistent with the for loop. I think it is fair to say that all regret that decision. This is one..
ExecuteReader requires an open and available Connection. The connection's current state is Connecting http://stackoverflow.com/questions/9705637/executereader-requires-an-open-and-available-connection-the-connections-curren almost every day a similar comment since many people think that it would be smart to encapsulate ADO.NET functionality..
Singleton double-check concurrency issue http://stackoverflow.com/questions/10281044/singleton-double-check-concurrency-issue allowed to float down past an arrow or up past an arrow. Think of the arrow head as pushing everything away. var local instance..
What are some advantages to using an interface in C#? http://stackoverflow.com/questions/1035632/what-are-some-advantages-to-using-an-interface-in-c question An interface says how something should work. Think of it as a contract or a template. It is key to things such..
Kinect SDK player detection http://stackoverflow.com/questions/10562554/kinect-sdk-player-detection I can't detect which one which player left from the game. Think that there are 2 cars in the game. First detected player call..
Send a file via HTTP POST with C# http://stackoverflow.com/questions/1131425/send-a-file-via-http-post-with-c-sharp files to a web server not by FTP but by HTTP using POST. Think of it like a web form but running on a windows application...
How to start unit testing or TDD? http://stackoverflow.com/questions/1365943/how-to-start-unit-testing-or-tdd e.g. on a stack Pop WhenStackIsEmpty ThrowsException . Think of all the inputs you can throw at it different combinations..
Why does one use dependency injection? [closed] http://stackoverflow.com/questions/14301389/why-does-one-use-dependency-injection without recompiling To give you a useful example for this Think of a software that does not log normally but when your customer.. are being used for defining and resolving dependencies. Think of property injection as an optional dependency and of constructor..
Why does BitmapSource.Create throw an ArgumentException? http://stackoverflow.com/questions/1983781/why-does-bitmapsource-create-throw-an-argumentexception this formula would over count the padding by a byte. Think of a 1 pixel wide bitmap using 1 bpp. The stride is 4 and the..
Why do we need boxing and unboxing in C#? http://stackoverflow.com/questions/2111857/why-do-we-need-boxing-and-unboxing-in-c bits which is completely different than a reference type . Think of it like this. You have a variable o of type object . And.. object o2 e Console.WriteLine d e Console.WriteLine o1 o2 Think about it for a second before going on to the next sentence...
“Treat all warnings as errors except…” in Visual Studio http://stackoverflow.com/questions/267168/treat-all-warnings-as-errors-except-in-visual-studio for those who don't see immediately why this is useful. Think about how most warnings work. They tell you something is a little..
simultaneous read-write a file in C# http://stackoverflow.com/questions/3817477/simultaneous-read-write-a-file-in-c-sharp to monitor changes to as well as add changes of my own. Think like Tail f foo.txt . Based on this thread it looks like I should..
Is this thread.abort() normal and safe? http://stackoverflow.com/questions/421389/is-this-thread-abort-normal-and-safe a half second timeout and resetting it on each keystroke. Think about it a fast typist might create a score of threads before..
In C# what is the difference between myInt++ and ++myInt? http://stackoverflow.com/questions/437026/in-c-sharp-what-is-the-difference-between-myint-and-myint
Validation: How to inject A Model State wrapper with Ninject? http://stackoverflow.com/questions/4776396/validation-how-to-inject-a-model-state-wrapper-with-ninject will be very glad when you have such a flexible design. Think about what you have to do if you want to change the validation..
Model-View-Presenter in WinForms http://stackoverflow.com/questions/4794121/model-view-presenter-in-winforms from treeview node colour to datagrid size etc Yes. Think about it as the presenter providing XML that describes data..
In C#, why can't a List<string> object be stored in a List<object> variable http://stackoverflow.com/questions/6557/in-c-why-cant-a-liststring-object-be-stored-in-a-listobject-variable covariance type safety share improve this question Think of it this way if you were to do such a cast and then add an..
Tree data structure in C# http://stackoverflow.com/questions/66893/tree-data-structure-in-c-sharp for. I just want a generic tree which can be unbalanced. Think of a directory tree. C5 looks nifty but their tree structures..
ServiceStack.Net Redis: Storing Related Objects vs. Related Object Ids http://stackoverflow.com/questions/8914349/servicestack-net-redis-storing-related-objects-vs-related-object-ids freedom on how you want to structure and store your data. Think how you would structure relationships in code So the best way..
Foreach can throw an InvalidCastException? http://stackoverflow.com/questions/949798/foreach-can-throw-an-invalidcastexception c# foreach language design share improve this question Think back to before generics... foreach had to cast so that you could..
|