¡@

Home 

c# Programming Glossary: while

How to properly clean up Excel interop objects

http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects

and have placed the following code in my finally clause while System.Runtime.InteropServices.Marshal.ReleaseComObject excelSheet..

Simple 2 way encryption for C#

http://stackoverflow.com/questions/165808/simple-2-way-encryption-for-c-sharp

0 do val byte.Parse str.Substring i 3 byteArr j val i 3 while i str.Length return byteArr Same comment as above. Normally..

How to stop BackgroundWorker on Form's Closing event?

http://stackoverflow.com/questions/1731384/how-to-stop-backgroundworker-on-forms-closing-event

backgroundWorker1_DoWork object sender DoWorkEventArgs e while this.bgWorker.CancellationPending Invoke Action this.textBox1.Text.. object sender CancelEventArgs e this.bgWorker.CancelAsync while this.bgWorker.CancellationPending deadlock c# winforms multithreading..

Dependency Inject (DI) “friendly” library

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

I hope it's clear how it would provide proper defaults while still making extensibility discoverable. share improve this..

Best way to copy between two Stream instances

http://stackoverflow.com/questions/230128/best-way-to-copy-between-two-stream-instances

input Stream output byte buffer new byte 32768 int read while read input.Read buffer 0 buffer.Length 0 output.Write buffer..

Why is lock(this) {…} bad?

http://stackoverflow.com/questions/251391/why-is-lockthis-bad

lock does not make the object read only. lock person.Name while person.Age 23 There will be a lock on 'person' due to the..

Randomize a List<T> in C#

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

T this IList T list Random rng new Random int n list.Count while n 1 n int k rng.Next n 1 T value list k list k list n list n.. provider new RNGCryptoServiceProvider int n list.Count while n 1 byte box new byte 1 do provider.GetBytes box while box.. while n 1 byte box new byte 1 do provider.GetBytes box while box 0 n Byte.MaxValue n int k box 0 n n T value list k list..

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

a level of abstraction allowing you to change the fields while not affecting the external way they are accessed by the things..

Use of Application.DoEvents()

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

monitor. The user could for example close the main window while the loop that calls DoEvents is running. That works user interface.. api design that requires you to keep your UI updated while an asynchronous operation is taking place. Like reading from..

When to use struct in C#?

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

the source however still impressive to fill 300k integers while resizing 15 times during the operation. Just out of curiosity..

Creating a blocking Queue<T> in .NET?

http://stackoverflow.com/questions/530211/creating-a-blocking-queuet-in-net

maxSize public void Enqueue T item lock queue while queue.Count maxSize Monitor.Wait queue queue.Enqueue item.. Monitor.PulseAll queue public T Dequeue lock queue while queue.Count 0 Monitor.Wait queue T item queue.Dequeue if.. queue public bool TryDequeue out T value lock queue while queue.Count 0 if closing value default T return false Monitor.Wait..

Proper use of the IDisposable interface

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

managed resources because they might not be there anymore while still freeing unmanaged resources. The standard pattern to do..

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

or single dimensional arrays are simple IL instructions while same operations for multidimensional arrays are method invocations..

Deep cloning objects in C#

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

deep clone object copier I found on The Code Project a while ago and incorporated it in our stuff. As mentioned elsewhere..

new keyword in method signature

http://stackoverflow.com/questions/1014295/new-keyword-in-method-signature

keyword in method signature While performing a refactoring I ended up creating a method like the..

What is “Best Practice” For Comparing Two Instances of a Reference Type?

http://stackoverflow.com/questions/104158/what-is-best-practice-for-comparing-two-instances-of-a-reference-type

comparing reference expected data against that returned . While looking over some of the coding standards guidelines in MSDN..

Easier way to start debugging a windows service in C#

http://stackoverflow.com/questions/125964/easier-way-to-start-debugging-a-windows-service-in-c-sharp

There the code will only be enabled during Debug builds. While your at it it might be useful to create a separate Build Configuration..

Soft Delete Entity Framework Code First

http://stackoverflow.com/questions/12698793/soft-delete-entity-framework-code-first

And that excludes deleted items from the index Note While navigation properties are not populated if the related item..

When to use ref vs out

http://stackoverflow.com/questions/1516876/when-to-use-ref-vs-out

they should use the parameter keyword out instead of ref . While I I think understand the difference between the ref and out..

switch / pattern matching idea

http://stackoverflow.com/questions/156467/switch-pattern-matching-idea

above and possibly some other scenarios I'm not aware of While it would be lovely for C# to eventually borrow ahem some of..

Why does C# not provide the C++ style 'friend' keyword?

http://stackoverflow.com/questions/203616/why-does-c-sharp-not-provide-the-c-style-friend-keyword

how to do something similar to friend in a C# application. While the answers generally revolve around nested classes it doesn't..

Why .NET String is immutable? [duplicate]

http://stackoverflow.com/questions/2365272/why-net-string-is-immutable

on state rather than identity. This means that abc ab c . While this doesn't require immutability the fact that a reference..

How costly is .NET reflection?

http://stackoverflow.com/questions/25458/how-costly-is-net-reflection

I constantly hear how bad reflection is to use. While I generally avoid reflection and rarely find situations where..

Get the property, as a string, from an Expression<Func<TModel,TProperty>>

http://stackoverflow.com/questions/2789504/get-the-property-as-a-string-from-an-expressionfunctmodel-tproperty

I need a string of Address.State.Abbreviation While it's not important for an answer to my question I suspect my..

How do the major C# DI/IoC frameworks compare?

http://stackoverflow.com/questions/4581791/how-do-the-major-c-sharp-di-ioc-frameworks-compare

unity ioc container ninject share improve this question While a comprehensive answer to this question takes up hundreds of..

What is the difference between null and System.DBNull.Value?

http://stackoverflow.com/questions/4958379/what-is-the-difference-between-null-and-system-dbnull-value

rdr Id System.DBNull.Value int x Convert.ToInt32 rdr Id While I retrieve data from the database using a sql datareader though..

WPF MVVM Newbie - how should the ViewModel close the form?

http://stackoverflow.com/questions/501886/wpf-mvvm-newbie-how-should-the-viewmodel-close-the-form

seems rather silly that the accepted answer is at 5 votes While I'm well aware of the good feelings that one gets by solving..

Are floating-point numbers consistent in C#? Can they be?

http://stackoverflow.com/questions/6683059/are-floating-point-numbers-consistent-in-c-can-they-be

The workarounds I considered Implement FixedPoint32 in C#. While this is not too hard I have a half finished implementation the..

POCO vs DTO

http://stackoverflow.com/questions/725348/poco-vs-dto

is a pattern that is used to transfer data using objects. While you can treat POCOs like DTOs you run the risk of creating an..

C# - What is the best way to modify a list in a 'foreach' loop?

http://stackoverflow.com/questions/759966/c-sharp-what-is-the-best-way-to-modify-a-list-in-a-foreach-loop

Effect of Concurrency Removing Items from a Collection While Enumerating for information on this change. What is the best..

Why would you use Expression<Func<T>> rather than Func<T>?

http://stackoverflow.com/questions/793571/why-would-you-use-expressionfunct-rather-than-funct

gets no parameters and returns the value 10 larger image While they both look the same at compile time what the compiler generates..

Entity Framework - Using Transactions or SaveChanges(false) and AcceptAllChanges()?

http://stackoverflow.com/questions/815586/entity-framework-using-transactions-or-savechangesfalse-and-acceptallchanges

context1.AcceptAllChanges context2.AcceptAllChanges While the call to SaveChanges false sends the necessary commands to..

How to build a query string for a URL in C#?

http://stackoverflow.com/questions/829080/how-to-build-a-query-string-for-a-url-in-c

a query string to including all the necessary parameters. While by all means no rocket science there are some nifty details..

How to use HTML Agility pack

http://stackoverflow.com/questions/846994/how-to-use-html-agility-pack

with other stream oriented classes in the .NET framework. While HtmlEntity.DeEntitize is another useful method for processing..