c# Programming Glossary: let's
C# : Why doesn't 'ref' and 'out' support polymorphism? http://stackoverflow.com/questions/1207144/c-sharp-why-doesnt-ref-and-out-support-polymorphism commentary on this issue. Thanks for the great question. Let's suppose you have classes Animal Mammal Reptile Giraffe Turtle..
Convert Pixels to Points http://stackoverflow.com/questions/139655/convert-pixels-to-points about the topic but can't seem to locate a simple formula. Let's assume a standard 96dpi how do I calulate this conversion c#..
Volatile vs. Interlocked vs. lock http://stackoverflow.com/questions/154551/volatile-vs-interlocked-vs-lock vs. Interlocked vs. lock Let's say that a class has a public int counter field that is accessed..
String output: format or concat in C#? http://stackoverflow.com/questions/16432/string-output-format-or-concat-in-c output format or concat in C# Let's say that you want to output or concat strings. Which of the..
the difference between try/catch/throw and try/catch(e)/throw e http://stackoverflow.com/questions/1697216/the-difference-between-try-catch-throw-and-try-catche-throw-e Which one should you use It really depends on each case. Let's say you have a Person class with a .Save method that will persist.. with a .Save method that will persist it into a database. Let's say that your application executes the Person.Save method somewhere...
HTML.ActionLink method http://stackoverflow.com/questions/200476/html-actionlink-method method Let's say I have a class public class ItemController Controller public..
Difference between Covariance & Contra-variance http://stackoverflow.com/questions/2184551/difference-between-covariance-contra-variance type Tiger can be assigned to a variable of type Animal. Let's write a value of type X can be assigned to a variable of type..
C# Object Pooling Pattern implementation http://stackoverflow.com/questions/2510975/c-sharp-object-pooling-pattern-implementation so a better approach is to create a smart pooled object. Let's say we start with the following simple interface class public..
Covariance and contravariance real world example http://stackoverflow.com/questions/2662369/covariance-and-contravariance-real-world-example resources c# c# 4.0 share improve this question Let's say you have a class Person and a class that derives from it..
Calling generic method with a type argument known only at execution time http://stackoverflow.com/questions/325156/calling-generic-method-with-a-type-argument-known-only-at-execution-time null null No target no arguments Original answer Let's leave aside the obvious problems of calling a variable interface..
Entity Framework 4 - AddObject vs Attach http://stackoverflow.com/questions/3920111/entity-framework-4-addobject-vs-attach named Addresses which is a collection of Address entity. Let's say you have read both Objects from context but they are not..
DateTime vs DateTimeOffset http://stackoverflow.com/questions/4331189/datetime-vs-datetimeoffset instead of a UTC DateTime It's all about perspective. Let's use an analogy we'll pretend to be photographers. Imagine you..
ANTLR 3.3 C# Tutorials? [closed] http://stackoverflow.com/questions/4396080/antlr-3-3-c-sharp-tutorials that. c# parsing antlr share improve this question Let's say you want to parse simple expressions consisting of the following..
Casting vs using the 'as' keyword in the CLR http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr afterwards. So let's not worry about the performance. Let's worry about correctness and consistency. I maintain that is..
When to use struct in C#? http://stackoverflow.com/questions/521298/when-to-use-struct-in-c find yourself boxing a struct rethink your architecture. Let's look at why Microsoft would use these structs Each struct Entry..
Easiest way to create a cascade dropdown in ASP.NET MVC 3 with C# http://stackoverflow.com/questions/5497524/easiest-way-to-create-a-cascade-dropdown-in-asp-net-mvc-3-with-c-sharp a specific set of months depending on the selected year. Let's put it simple. When I choose the current year i.e. 2011 in the..
Tree data structure in C# http://stackoverflow.com/questions/66893/tree-data-structure-in-c-sharp of nodes and here are some options to get you started. Let's assume that the class Node is the base class of the entire solution...
LINQ - Left Join, Group By, and Count http://stackoverflow.com/questions/695506/linq-left-join-group-by-and-count Left Join Group By and Count Let's say I have this SQL SELECT p.ParentId COUNT c.ChildId FROM ParentTable..
Why should I implement ICloneable in c#? http://stackoverflow.com/questions/699210/why-should-i-implement-icloneable-in-c I want to do a deep copy can't I just implement my method Let's say MyClone Why should I inherit from ICloneable What are the..
How to convert a Unicode character to its ASCII equivalent http://stackoverflow.com/questions/138449/how-to-convert-a-unicode-character-to-its-ascii-equivalent c# .net unicode ascii share improve this question Okay let's elaborate. Both csgero and bzlm pointed in the right direction...
Keeping ASP.NET Session Open / Alive http://stackoverflow.com/questions/1431733/keeping-asp-net-session-open-alive .fadeOut 500 1000 beat every second after n times let's clear the interval adding 100ms of safe gap setTimeout function..
How do ValueTypes derive from Object (ReferenceType) and still be ValueTypes? http://stackoverflow.com/questions/1682231/how-do-valuetypes-derive-from-object-referencetype-and-still-be-valuetypes long as it is either System.ValueType or System.Enum. So let's rephrase your question How do ValueTypes derive from Object..
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 memory management share improve this question Okay let's see if I can make this any clearer. Firstly Ash is right the.. on the topic and will expand on it if requested but let's deal with just the new operator. Secondly all of this really..
How do I intercept a method call in C#? http://stackoverflow.com/questions/25803/how-do-i-intercept-a-method-call-in-c exactly the same way. To make the question more concrete let's assume there are 3 classes public class Caller public static..
Changing master volume level http://stackoverflow.com/questions/294292/changing-master-volume-level or MixerInfo mi GetMixerControls SetVolume mi mi.maxVolume let's get this party crunk'd or MixerInfo mi GetMixerControls SetMute..
What do 'statically linked' and 'dynamically linked' mean? http://stackoverflow.com/questions/311882/what-do-statically-linked-and-dynamically-linked-mean down and punished severely by the way . As an example let's look at the case of a user compiling their main.c file for static..
How do I use IValidatableObject? http://stackoverflow.com/questions/3400542/how-do-i-use-ivalidatableobject is used to validate an object in a way that let's one compare properties against each other. I'd still like to..
C# - Multiple generic types in one list http://stackoverflow.com/questions/353126/c-sharp-multiple-generic-types-in-one-list struct private DataType mDataType There's more to it but let's keep it simple. The generic type DataType is limited to value..
Entity Framework 4 - AddObject vs Attach http://stackoverflow.com/questions/3920111/entity-framework-4-addobject-vs-attach is Added. You have to use Add in this case. For example let's assume your Person entity has a navigation property named Addresses..
Difference between shadowing and overriding in C#? http://stackoverflow.com/questions/392721/difference-between-shadowing-and-overriding-in-c clB.Foo output 1 Console.WriteLine clB.Bar output 1 now let's cast B to an A class Console.WriteLine A clB .Foo output 5 Console.WriteLine..
Casting vs using the 'as' keyword in the CLR http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr aren't going to do anything with the values afterwards. So let's not worry about the performance. Let's worry about correctness..
Proper use of the IDisposable interface http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface rid of managed resources because we want to be helpful So let's update our Dispose method to get rid of those managed objects..
How would you code an efficient Circular Buffer in Java or C# http://stackoverflow.com/questions/590069/how-would-you-code-an-efficient-circular-buffer-in-java-or-c-sharp
How to check if a number is a power of 2 http://stackoverflow.com/questions/600293/how-to-check-if-a-number-is-a-power-of-2 is true if and only if both its operands are true. Now let's take a look at how this all plays out The function returns boolean..
Understanding events and event handlers in C# http://stackoverflow.com/questions/803242/understanding-events-and-event-handlers-in-c-sharp delegate. So knowing how to create a reference to a method let's think about the purpose of events we want to cause some code..
Algorithm to find which numbers from a list of size n sum to another number http://stackoverflow.com/questions/83547/algorithm-to-find-which-numbers-from-a-list-of-size-n-sum-to-another-number of size n sum to another number I have a decimal number let's call it goal and an array of other decimal numbers let's call.. let's call it goal and an array of other decimal numbers let's call the array elements and I need to find all the combinations..
How can I ensure that a division of integers is always rounded up? http://stackoverflow.com/questions/921180/how-can-i-ensure-that-a-division-of-integers-is-always-rounded-up input. That undefined behaviour is deeply worrying so let's eliminate it. We'll say that our operation has this specification..
|