¡@

Home 

c# Programming Glossary: or

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

the thread it was created on I have a scenario. Windows Forms C# .NET There is a main form which hosts some user control... I have a scenario. Windows Forms C# .NET There is a main form which hosts some user control. The user control does some heavy.. the UserControl_Load method the UI become nonresponsive for the duration for load method execution. To overcome this I load..

How to properly clean up Excel interop objects

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

excelSheet 0 excelSheet null GC.Collect GC.WaitForPendingFinalizers Although this kind of works the Excel.exe process.. GC.WaitForPendingFinalizers Although this kind of works the Excel.exe process is still in the background even after.. is manually closed. Anyone realize what I am doing wrong or has an alternative to ensure interop objects are properly disposed..

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

MyClass this is a field. It is private to your class and stores the actual data. private string _myField this is a property... fields they could do a calculation on other fields or serve other purposes. @GSS points out that you can also do other..

How do you convert Byte Array to Hexadecimal String, and vice versa?

http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa

byte ba StringBuilder hex new StringBuilder ba.Length 2 foreach byte b in ba hex.AppendFormat 0 x2 b return hex.ToString.. StringBuilder ba.Length 2 foreach byte b in ba hex.AppendFormat 0 x2 b return hex.ToString or public static string ByteArrayToString.. byte b in ba hex.AppendFormat 0 x2 b return hex.ToString or public static string ByteArrayToString byte ba string hex BitConverter.ToString..

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.. overridden the Equals method because Foo represent a row for the Foos table. Which is the preferred method for overriding.. a row for the Foos table. Which is the preferred method for overriding the GetHashCode Why is it important to override GetHashCode..

Casting vs using the 'as' keyword in the CLR

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

vs using the 'as' keyword in the CLR I'm learning about design patterns and because.. What I've found is that I'm doing a lot of casting or object type conversion. What I'd like to know is if there is.. public class MyClass IMyInterface public void AMethod Do work Other helper methods.... public class Implementation IMyInterface..

Use of Application.DoEvents()

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

Hmya the enduring mystique of DoEvents . There's been an enormous amount of backlash against it but nobody ever really explains.. a struct . Erm why does the runtime and the language supports mutating a struct if that's so bad Same reason you shoot yourself.. not easy to grok. Right off the bat almost any Winforms program actually contains a call to DoEvents . It is cleverly..

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

and double are floating binary point types . In other words they represent a number like this 10001.10010110011 The binary.. decimal is a floating decimal point type . In other words they represent a number like this 12345.65789 Again the number.. floating point type instead of a fixed point type. The important thing to note is that humans are used to representing non..

Deep cloning objects in C#

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

changes to the new object that are not reflected in the original object. I don't often need this functionality so when.. this functionality so when it's been necessary I've resorted to creating a new object and then copying each property individually.. always leaves me with the feeling that there is a better or more elegant way of handling the situation. How can I clone..

How to use HTML Agility pack

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

to HTMLAgilityPack.dll in the HTMLAgilityPack Debug or Realease bin folder. Then as an example HtmlAgilityPack.HtmlDocument.. load from a string was htmlDoc.LoadXML xmlString ParseErrors is an ArrayList containing any errors from the Load statement.. xmlString ParseErrors is an ArrayList containing any errors from the Load statement if htmlDoc.ParseErrors null htmlDoc.ParseErrors.Count..

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

to repeatedly access 1 image file. Most of the time it works but if my computer's running fast it will try to access the.. computer's running fast it will try to access the file before it's been saved back to the filesystem and throw an error File.. it's been saved back to the filesystem and throw an error File in use by another process . I would like to find a way..

Why is there not a ForEach extension method on the IEnumerable interface?

http://stackoverflow.com/questions/101265/why-is-there-not-a-foreach-extension-method-on-the-ienumerable-interface

there no ForEach extension method in the Enumerable class Or anywhere The only class that gets a ForEach method is List ...

Implementing INotifyPropertyChanged - does a better way exist?

http://stackoverflow.com/questions/1315621/implementing-inotifypropertychanged-does-a-better-way-exist

get set notify I think it makes a lot of sense to do it. Or are there any complications to do it Can we ourselves implement..

Complex UI inside ListBoxItem

http://stackoverflow.com/questions/15532639/complex-ui-inside-listboxitem

Docking and Anchoring in Windows Forms to accomplish this. Or you can add custom event handlers to perform appropriate layout..

Multiple Inheritance in C#

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

there is a solution using some kind of code generation Or it may look like this imaginary c# syntax public class FirstAndSecond..

How to convert UNIX timestamp to DateTime and vice versa?

http://stackoverflow.com/questions/249760/how-to-convert-unix-timestamp-to-datetime-and-vice-versa

unixTimeStamp .ToLocalTime return dtDateTime Or for Java which is different public static DateTime JavaTimeStampToDateTime..

Why is lock(this) {…} bad?

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

Is it because the lock will be held longer than necessary Or is there some more insidious reason c# multithreading locking..

How to fix the flickering in User controls

http://stackoverflow.com/questions/2612487/how-to-fix-the-flickering-in-user-controls

badly with the BackgroundImage when it is dark. Or they can be black if the form has its Opacity or TransparencyKey.. image to be a better match with the typical control size. Or write code in the UC's OnResize method to create a properly..

Do event handlers stop garbage collection from occuring?

http://stackoverflow.com/questions/298261/do-event-handlers-stop-garbage-collection-from-occuring

MyFunction pClass null Will pClass be garbage collected Or will it hang around still firing its events whenever they occur..

Cross-thread operation not valid [duplicate]

http://stackoverflow.com/questions/5037470/cross-thread-operation-not-valid

then call Control.Invoke and do your databinding there. Or use a BackgroundWorker BackgroundWorker bw new BackgroundWorker..

C# - The foreach identifier and closures

http://stackoverflow.com/questions/512166/c-sharp-the-foreach-identifier-and-closures

the same loop iteration in which the thread was created Or must you copy the reference to a new variable local to each..

Use of Application.DoEvents()

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

window and start the job again failure modes are solved. Or to put it another way there is no way for the user to make your..

LINQ to SQL: Return anonymous type?

http://stackoverflow.com/questions/534690/linq-to-sql-return-anonymous-type

way to return this without having to create a custom type Or do I have to create my own class for DogsWithBreedNames and.. for DogsWithBreedNames and specify that type in the select Or is there another easier way Thanks in advance. c# asp.net linq..

Accessing a Shared File (UNC) From a Remote, Non-Trusted Domain With Credentials

http://stackoverflow.com/questions/659013/accessing-a-shared-file-unc-from-a-remote-non-trusted-domain-with-credentials

I miss a super secret win32 function that does what I want Or must I pursue some variant of option 3 c# windows unc file..

Create code first, many to many, with additional fields in association table

http://stackoverflow.com/questions/7050404/create-code-first-many-to-many-with-additional-fields-in-association-table

get set How do I configure my association with fluent API Or is there a better way to create the association table Thank.. get set public class MemberComment Key Column Order 0 public int MemberID get set Key Column Order 1 public int.. Key Column Order 0 public int MemberID get set Key Column Order 1 public int CommentID get set public virtual Member Member..

C# Events and Thread Safety

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

thread tries to interact directly with your component. Or else implement a truly thread safe component not an easy task.. make sure that the empty delegate is cheap to instantiate. Or am I still missing something Surely it must be that as Jon Skeet..

C# Finalize/Dispose pattern

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

called when execution reaches the end of the using block Or does the client have to manually call the dispose method i.e...

recommend a library/API to unzip file in C#

http://stackoverflow.com/questions/1023476/recommend-a-library-api-to-unzip-file-in-c-sharp

The LGPL http www.icsharpcode.net OpenSource SharpZipLib OR the less restrictive Ms PL http www.codeplex.com DotNetZip To..

C# How to find if an event is hooked up

http://stackoverflow.com/questions/1129517/c-sharp-how-to-find-if-an-event-is-hooked-up

Use reflection to access the compiler generated delegate OR Create a non private delegate perhaps internal and implement..

Direct casting vs 'as' operator?

http://stackoverflow.com/questions/132445/direct-casting-vs-as-operator

o EventArgs e I swear o is a string string s string o 1 OR string s o as string 2 OR string s o.ToString 3 What is the.. is a string string s string o 1 OR string s o as string 2 OR string s o.ToString 3 What is the difference between the three..

How do I split a string by strings and include the delimiters using .NET?

http://stackoverflow.com/questions/2484919/how-do-i-split-a-string-by-strings-and-include-the-delimiters-using-net

be escaped . . Given a list of delimiters you need to OR them using the pipe symbol and that too is a character that..

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

something like... obj Convert obj.Property e.g. int object OR obj ConvertChecked obj.Property e.g. int long ...which are the..

multimap in .NET

http://stackoverflow.com/questions/380595/multimap-in-net

IS PROVIDED BY SOLUTIONS DESIGN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED.. TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOLUTIONS.. PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOLUTIONS DESIGN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL..

Entity Framework 4 - AddObject vs Attach

http://stackoverflow.com/questions/3920111/entity-framework-4-addobject-vs-attach

existingPerson.Addresses.Attach myAddress OR myAddress.PersonReference.Attach existingPerson ctx.SaveChanges..

Combining two expressions (Expression<Func<T, bool>>)

http://stackoverflow.com/questions/457316/combining-two-expressions-expressionfunct-bool

of type Expression Func T bool and I want to take to OR AND or NOT of these and get a new expression of the same type..

MVC3 Razor DropDownListFor Enums

http://stackoverflow.com/questions/4656758/mvc3-razor-dropdownlistfor-enums

expression p p.Foo.Bar .Baz.ToString p.Foo OR throw... MethodCallExpression methodCallExpression expression.Object..

Show Console in Windows Application?

http://stackoverflow.com/questions/472282/show-console-in-windows-application

To run in gui mode EITHER just double click the exe OR start it from the cmd prompt with c path to Debug dir WindowsApplication.exe..

Entity Framework 4.1. Most efficient way to get multiple entities by primary key?

http://stackoverflow.com/questions/8107439/entity-framework-4-1-most-efficient-way-to-get-multiple-entities-by-primary-key

which will be created is expanded into a long chain of OR concatenations because there is no native expression which represents.. an IN . When the SQL is created this expression of many OR s is recognized and collapsed back into the SQL IN clause. This..