¡@

Home 

c# Programming Glossary: avoid

Parse JSON in C#

http://stackoverflow.com/questions/1212344/parse-json-in-c-sharp

if you're using the 3.5 Framework you can just do this and avoid the backing fields and let the compiler take care of that public..

How to check for file lock?

http://stackoverflow.com/questions/1304/how-to-check-for-file-lock

Create Excel (.XLS and .XLSX) file from C# [closed]

http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp

third party dependencies to my code and I would like to avoid using Excel directly to create the file using OLE Automation...

Volatile vs. Interlocked vs. lock

http://stackoverflow.com/questions/154551/volatile-vs-interlocked-vs-lock

write operations which is the problem you are trying to avoid. Second Best lock this.locker this.counter This is safe to do..

Multiple Inheritance in C#

http://stackoverflow.com/questions/178333/multiple-inheritance-in-c-sharp

solution to just combine those two into one class. To avoid conflicts this may be done by code generation where the result..

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

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

current instance To cast itself to another type You can avoid the first usage by declaring getter and setter for all fields..

When to Use Static Classes in C#

http://stackoverflow.com/questions/241339/when-to-use-static-classes-in-c-sharp

solution in the future. And finally if you want to avoid creating instances simply create a singleton wrapper of your..

How is Generic Covariance & Contra-variance Implemented in C# 4.0?

http://stackoverflow.com/questions/245607/how-is-generic-covariance-contra-variance-implemented-in-c-sharp-4-0

C# 4 will make this more generic and I believe will avoid creating a new instance for the conversion. It'll be a reference..

Windows service and timer

http://stackoverflow.com/questions/246697/windows-service-and-timer

will work for services. The timers you want to avoid are System.Web.UI.Timer and System.Windows.Forms.Timer which..

High Quality Image Scaling C#

http://stackoverflow.com/questions/249587/high-quality-image-scaling-c-sharp

new Bitmap width height set the resolutions the same to avoid cropping due to resolution differences result.SetResolution..

Why is lock(this) {…} bad?

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

null throw new ArgumentNullException subject You should avoid locking on strings since they are immutable. if Monitor.TryEnter..

Deserialize JSON into C# dynamic object?

http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object

binder.Name out result return null to avoid exception. caller can check for null this way... result null.. indexes 0 .ToString out result return null to avoid exception. caller can check for null this way... result null..

Use of Application.DoEvents()

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

of all your forms to false is a quick and efficient way to avoid problems. Of course no programmer ever actually likes doing..

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

suggested workaround in the MSDN article is to completely avoid using a using block and to instead instantiate your clients..

C# Events and Thread Safety

http://stackoverflow.com/questions/786383/c-sharp-events-and-thread-safety

and yet they just unsubscribed specifically to avoid that happening. Surely what is really needed is a custom event.. it wasn't clear I did grasp the intention of the advice to avoid a null reference exception under all circumstances. My point.. Delegates are immutable. As far as I can see this is unavoidable. Using an empty delegate certainly avoids the nullity check..

Is there a way to check if a file is in use?

http://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use

your hesitation about using exceptions but you can't avoid them all of the time protected virtual bool IsFileLocked FileInfo..

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

on the next Open call. So obviously there's no reason to avoid creating opening or closing connections since actually they.. not implement IDisposable var tblPromotion new DataTable avoid SQL Injection da.SelectCommand.Parameters.Add @PromotionID SqlDbType.Int..

Best Practices of Test Driven Development Using C# and RhinoMocks [closed]

http://stackoverflow.com/questions/124210/best-practices-of-test-driven-development-using-c-sharp-and-rhinomocks

to keep your tests readable. Refer back to previous point. Avoid the temptation to refactor duplication out of your unit tests..

Avoid duplicate names in a dataset

http://stackoverflow.com/questions/13090398/avoid-duplicate-names-in-a-dataset

duplicate names in a dataset I am fetching data from a table..

How to Avoid Firing ObservableCollection.CollectionChanged Multiple Times When Replacing All Elements Or Adding a Collection of Elements

http://stackoverflow.com/questions/13302933/how-to-avoid-firing-observablecollection-collectionchanged-multiple-times-when-r

to Avoid Firing ObservableCollection.CollectionChanged Multiple Times..

ASP.NET Website Slow Performance on production server

http://stackoverflow.com/questions/1340218/asp-net-website-slow-performance-on-production-server

performance Disable ViewState as and when not required. Avoid Frequent round trips to the Database Avoid Throwing Exceptions... not required. Avoid Frequent round trips to the Database Avoid Throwing Exceptions. Exceptions are a greate way to handle errors..

Are doubles faster than floats in c#?

http://stackoverflow.com/questions/158889/are-doubles-faster-than-floats-in-c

types increase memory size and bandwidth requirements. ... Avoid mixed data type arithmetic expressions That last point is important..

Asynchronous Delegates Vs Thread/ThreadPool?

http://stackoverflow.com/questions/1837962/asynchronous-delegates-vs-thread-threadpool

are handled automatically through its event based model. Avoid BackgroundWorker if 1 your assembly does not already reference.. associated with creating starting and stopping threads. Avoid using the ThreadPool if 1 the task runs for the lifetime of..

Avoid calling Invoke when the control is disposed

http://stackoverflow.com/questions/1874728/avoid-calling-invoke-when-the-control-is-disposed

calling Invoke when the control is disposed I have the following..

Algorithm to avoid SQL injection on MSSQL Server from C# code?

http://stackoverflow.com/questions/249567/algorithm-to-avoid-sql-injection-on-mssql-server-from-c-sharp-code

and or parameterized queries as much as possible. Avoid dynamic sql both in db client code and in sql. Avoid exec statements.. Avoid dynamic sql both in db client code and in sql. Avoid exec statements with dynamic code with external sections in..

In C# would it be better to use Queue.Synchronized or lock() for thread safety?

http://stackoverflow.com/questions/338712/in-c-sharp-would-it-be-better-to-use-queue-synchronized-or-lock-for-thread-saf

period as possible more for correctness than performance . Avoid calling into unknown code while holding a lock avoid nested..

Are string.Equals() and == operator really same? [duplicate]

http://stackoverflow.com/questions/3678792/are-string-equals-and-operator-really-same

determined based on the compile time types of the objects Avoid getting confused by interning object x new StringBuilder hello..

Application.OpenForms.Count = 0 always

http://stackoverflow.com/questions/3751554/application-openforms-count-0-always

is that the Application class loses track of the form. Avoid the bug by setting the property only in the constructor never..

How do you disable an item in listview control in .net 3.5

http://stackoverflow.com/questions/5472172/how-do-you-disable-an-item-in-listview-control-in-net-3-5

to pick the theme color for disabled items. Avoid disabling selection it prevents the user from using the keyboard...

High performance TCP server in C#

http://stackoverflow.com/questions/6023264/high-performance-tcp-server-in-c-sharp

one more thing if you look at 1k connections you need to Avoid TCP IP Port Exhaustion the link is for BizTalk but the issue..

Asp.net mvc override OnException in base controller keeps propogating to Application_Error

http://stackoverflow.com/questions/6324368/asp-net-mvc-override-onexception-in-base-controller-keeps-propogating-to-applica

exception Clear the error on server. Server.ClearError Avoid IIS7 getting in the middle Response.TrySkipIisCustomErrors true..

Which exceptions shouldn't I catch?

http://stackoverflow.com/questions/7152354/which-exceptions-shouldnt-i-catch

the exception and continue executing. Few other rules Avoid handling errors by catching non specific exceptions such as..

Using Inner classes in C#

http://stackoverflow.com/questions/804453/using-inner-classes-in-c-sharp

Design and Guidelines I see that this is marked as Avoid however I use it in scenarios similar to enums althogh that's..

Why does this Parallel.ForEach code freeze the program up?

http://stackoverflow.com/questions/8365346/why-does-this-parallel-foreach-code-freeze-the-program-up

processing in your UI thread. See the example under the Avoid Executing Parallel Loops on the UI Thread header in this page..