¡@

Home 

c# Programming Glossary: when

Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on

http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the

worker thread which will be loading the data and when done will notify the application that it has done its work...

Randomize a List<T> in C#

http://stackoverflow.com/questions/273313/randomize-a-listt-in-c-sharp

is available at http thegrenade.blogspot.com 2010 02 when random is too consistent.html Edit Since writing this answer..

How to force my .NET App to run as administrator on Windows 7?

http://stackoverflow.com/questions/2818179/how-to-force-my-net-app-to-run-as-administrator-on-windows-7

uiAccess false The user gets the UAC prompt when they start the program. Use wisely their patience can wear out..

What is the difference between a field and a property in C#?

http://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c

C# In C# what makes a field different from a property and when should a field be used instead of a property c# properties.. out that you can also do other logic such as validation when a property is accessed another useful feature. share improve..

Why is it important to override GetHashCode when Equals method is overridden?

http://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overridden

is it important to override GetHashCode when Equals method is overridden Given the following class public.. you might also consider providing and operators when overriding Equals and GethashCode . A demonstration of what..

Why are mutable structs evil?

http://stackoverflow.com/questions/441309/why-are-mutable-structs-evil

Structs are value types which means they are copied when they are passed around. So if you change a copy you are changing..

Casting vs using the 'as' keyword in the CLR

http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr

I maintain that is and cast or is and as are both unsafe when dealing with variables as the type of the value it refers to..

Use of Application.DoEvents()

http://stackoverflow.com/questions/5181777/use-of-application-doevents

to use DoEvents to stop their user interface from freezing when they write their own modal loop. It certainly does that it dispatches.. That could work but boy the odds are slim. Especially when the nested loop ends and the suspended one resumes trying to.. order. It will execute predictably just like it did when you tested your code. It makes dialogs extremely annoying who..

Proper use of the IDisposable interface

http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface

save their bacon We still have a way to call it for them when the garbage collector finally gets around to freeing i.e. finalizing.. method. That was just a name we chose for a method we call when we want to get rid of unmanaged stuff. The destruction of our.. then don't forget to call their base Dispose method when you overrode Dispose public Dispose try Dispose true true safe..

What is the difference between Decimal, Float and Double in C#?

http://stackoverflow.com/questions/618535/what-is-the-difference-between-decimal-float-and-double-in-c

an approximation to 0.1. You'll still get approximations when using a floating decimal point as well the result of dividing.. be exactly represented for example. As for what to use when For values which are naturally exact decimals it's good to use..

Deep cloning objects in C#

http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp

original object. I don't often need this functionality so when it's been necessary I've resorted to creating a new object and.. don't have to concern yourself about cloning everything when an object gets too complex. And with the use of extension methods..

What does the [Flags] Enum Attribute mean in C#?

http://stackoverflow.com/questions/8447/what-does-the-flags-enum-attribute-mean-in-c

improve this question The flags attribute should be used whenever the enumerable represents a collection of flags rather than.. looks like this myProperties.AllowedColors 00001110 So when you retreive the value you are actually bitwise AND'ing the..

Dependency Inject (DI) “friendly” library

http://stackoverflow.com/questions/2045904/dependency-inject-di-friendly-library

by using Constructor Injection . Use Constructor Injection When you need a dependency ask for it statically through the constructor..

When do you use the “this” keyword? [closed]

http://stackoverflow.com/questions/23250/when-do-you-use-the-this-keyword

do you use the &ldquo this&rdquo keyword closed This may be..

What is the difference between a field and a property in C#?

http://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c

actual data. private string _myField this is a property. When you access it uses the underlying field but only exposes the..

Best way to parse command line arguments in C#? [closed]

http://stackoverflow.com/questions/491595/best-way-to-parse-command-line-arguments-in-c

way to parse command line arguments in C# closed When building console applications that take parameters you can use..

VS2010 does not show unhandled exception message in a WinForms Application on a 64-bit version of Windows

http://stackoverflow.com/questions/4933958/vs2010-does-not-show-unhandled-exception-message-in-a-winforms-application-on-a

in a WinForms Application on a 64 bit version of Windows When I create a new project I get a strange behaviour for unhandeled..

When to use struct in C#?

http://stackoverflow.com/questions/521298/when-to-use-struct-in-c

to use struct in C# When should you use struct and not class.. to use struct in C# When should you use struct and not class in C# My conceptual model.. internal array from 150862 elements to 312874 elements. When you figure that each element is sequentially copied via Array.CopyTo..

Proper use of the IDisposable interface

http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface

collector will eventually free all managed objects. When it does it calls the Finalize method on the object. The GC doesn't.. But that didn't stop a subtle bug from creeping in. When the user calls Dispose the handle gdiCursorBitmapStreamFileHandle.. MB of internal images now since they're no longer needed. When we don't the machine grinds to a swapping halt. Bonus Reading..

What is differences between Multidimensional array and Array of Arrays in C#?

http://stackoverflow.com/questions/597720/what-is-differences-between-multidimensional-array-and-array-of-arrays-in-c

int32 IL_0009 ret end of method Program SetElementAt When using jagged arrays you can easily perform such operations as..

What is the difference between Decimal, Float and Double in C#?

http://stackoverflow.com/questions/618535/what-is-the-difference-between-decimal-float-and-double-in-c

is the difference between Decimal Float and Double in C# When would someone use one of these c# .net floating point double..

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

a reason for C#'s reuse of the variable in a foreach When using lambda expressions or anonymous methods in C# we have.. outside the loop body as it made no observable difference. When closure semantics were introduced in C# 2.0 the choice was made..

C# Finalize/Dispose pattern

http://stackoverflow.com/questions/898828/c-sharp-finalize-dispose-pattern

question The recommended IDisposable pattern is here . When programming a class that uses IDisposable generally you should.. uses IDisposable generally you should use two patterns When implementing a sealed class that doesn't use unmanaged resources.. of managed resources call Dispose on member variables... When implementing an unsealed class do it like this public class..

How can I detect the encoding/codepage of a text file

http://stackoverflow.com/questions/90838/how-can-i-detect-the-encoding-codepage-of-a-text-file

we receive text files .txt .csv etc. from diverse sources. When reading these files sometimes contain garbage because the files..

Pivot Table in c#

http://stackoverflow.com/questions/1069677/pivot-table-in-c-sharp

4 2.4 GO SELECT FROM Pivot GO SELECT Year SUM CASE Quarter WHEN 1 THEN Amount ELSE 0 END AS Q1 SUM CASE Quarter WHEN 2 THEN.. WHEN 1 THEN Amount ELSE 0 END AS Q1 SUM CASE Quarter WHEN 2 THEN Amount ELSE 0 END AS Q2 SUM CASE Quarter WHEN 3 THEN.. WHEN 2 THEN Amount ELSE 0 END AS Q2 SUM CASE Quarter WHEN 3 THEN Amount ELSE 0 END AS Q3 SUM CASE Quarter WHEN 4 THEN..

passing an operand as an sql parameter

http://stackoverflow.com/questions/10703072/passing-an-operand-as-an-sql-parameter

for ad hoc workload setting. WHERE Amount BETWEEN CASE WHEN @operand LIKE ' ' THEN 0 WHEN @operand ' ' THEN @operant 1 ELSE.. WHERE Amount BETWEEN CASE WHEN @operand LIKE ' ' THEN 0 WHEN @operand ' ' THEN @operant 1 ELSE @operant END AND CASE WHEN.. @operand ' ' THEN @operant 1 ELSE @operant END AND CASE WHEN @operand LIKE ' ' THEN 2147483647 WHEN @operand ' ' THEN @operant..

How can I use Entity Framework on an object graph past a depth of 2 with MySQL Connector / NET?

http://stackoverflow.com/questions/11676513/how-can-i-use-entity-framework-on-an-object-graph-past-a-depth-of-2-with-mysql-c

AS ClearanceId1 Join3 . Description AS Description4 CASE WHEN Join3 . ShipId IS NULL THEN NULL WHEN Join3 . CrewMemberId IS.. AS Description4 CASE WHEN Join3 . ShipId IS NULL THEN NULL WHEN Join3 . CrewMemberId IS NULL THEN NULL ELSE 1 END AS C1 CASE.. . CrewMemberId IS NULL THEN NULL ELSE 1 END AS C1 CASE WHEN Join3 . ShipId IS NULL THEN NULL ELSE 1 END AS C2 FROM Harbor..

Memcached on Windows (x64)

http://stackoverflow.com/questions/8896/memcached-on-windows-x64

on Windows x64 Does anyone know IF WHEN or HOW I can get Memcached running on a Windows 64bit environment..

linq case statement

http://stackoverflow.com/questions/936028/linq-case-statement

statements in linq c# osc_products.products_quantity CASE WHEN itempromoflag 'N' THEN 100000 WHEN itemcat1 IN '1' '2' '31'.. CASE WHEN itempromoflag 'N' THEN 100000 WHEN itemcat1 IN '1' '2' '31' AND itemsalestatus 'S' THEN 100000.. IN '1' '2' '31' AND itemsalestatus 'S' THEN 100000 WHEN itemsalestatus 'O' THEN 0 ELSE cds_oeinvitem.itemqtyonhand cds_oeinvitem.itemqtycommitted..

Field Initializer in C# Class not Run when Deserializing

http://stackoverflow.com/questions/9419743/field-initializer-in-c-sharp-class-not-run-when-deserializing

public class MyConcrete FIELD INITIALIZER DOES NOT RUN WHEN COMMENTED IN protected readonly Dictionary int string myDict..