¡@

Home 

c# Programming Glossary: do

How do you do a deep copy an object in .Net (C# specifically)?

http://stackoverflow.com/questions/129389/how-do-you-do-a-deep-copy-an-object-in-net-c-specifically

do you do a deep copy an object in .Net C# specifically I want.. do you do a deep copy an object in .Net C# specifically I want a true.. I want a true deep copy. In Java this was easy but how do you do it in C# c# .net serialization share improve this..

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

than the thread it was created on I have a scenario. Windows Forms C# .NET There is a main form which hosts some user control... main form which hosts some user control. The user control does some heavy data operation such that if I directly call the.. worker thread which will be loading the data and when done will notify the application that it has done its work. Now..

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

do you convert Byte Array to Hexadecimal String and vice versa.. ba return hex.Replace There are even more variants of doing it for example here . The reverse conversion would go like..

Sending email in .NET through Gmail

http://stackoverflow.com/questions/32260/sending-email-in-net-through-gmail

emails to the bands I play on my show. Is it possible to do c# .net email gmail share improve this question Be sure..

Dynamic LINQ OrderBy on IEnumerable<T>

http://stackoverflow.com/questions/41244/dynamic-linq-orderby-on-ienumerablet

improve this question Just stumbled into this oldie... To do this without the dynamic LINQ library you just need the code.. can't really represent dynamic queries MemberExpression doesn't support it . But here's a way to do it with LINQ to Objects... MemberExpression doesn't support it . But here's a way to do it with LINQ to Objects. Note that the choice of Hashtable is..

Why are mutable structs evil?

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

the same. If you want to change it you have to consciously do it by creating a new instance of the struct with the modified..

Use of Application.DoEvents()

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

rest of the app in much the same way that VB6's DoEvents does c# doevents share improve this question Hmya the enduring.. the app in much the same way that VB6's DoEvents does c# doevents share improve this question Hmya the enduring mystique.. ever really explains why it is bad . The same kind of wisdom as don't mutate a struct . Erm why does the runtime and the..

Random number generator only generating one random number

http://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number

number generator only generating one random number I have.. number generator only generating one random number I have the following function Function to get random.. number I have the following function Function to get random number public static int RandomNumber int min int max Random..

Deep cloning objects in C#

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

cloning objects in C# I want to do something like myObject myObj GetmyObj Create and fill a new.. object that are not reflected in the original object. I don't often need this functionality so when it's been necessary.. incorporated it in our stuff. As mentioned elsewhere it does require your objects to be serializable. using System using..

How to use HTML Agility pack

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

to use HTML Agility pack How do I use the HTML Agility Pack My XHTML document is not completely.. Agility pack How do I use the HTML Agility Pack My XHTML document is not completely valid. That's why I wanted to use it... not completely valid. That's why I wanted to use it. How do I use it in my project My project is in C#. c# html html agility..

How do I calculate someone's age in C#?

http://stackoverflow.com/questions/9/how-do-i-calculate-someones-age-in-c

do I calculate someone's age in C# Given a DateTime representing.. C# Given a DateTime representing a person's birthday how do I calculate their age c# .net datetime share improve this..

Elevating process privilege programatically?

http://stackoverflow.com/questions/133379/elevating-process-privilege-programatically

issue so how would I run my process in an elevated state Do I need to look at ShellExecute for this This is all on Windows..

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

delegate name textbox1.text if name MyName do whatever Do your serious processing in the separate thread before you attempt..

How To: Execute command line in C#, get STD OUT results

http://stackoverflow.com/questions/206323/how-to-execute-command-line-in-c-get-std-out-results

true p.StartInfo.FileName YOURBATCHFILE.bat p.Start Do not wait for the child process to exit before reading to the..

Automating the InvokeRequired code pattern

http://stackoverflow.com/questions/2367718/automating-the-invokerequired-code-pattern

code pattern in event driven GUI code where private void DoGUISwitch cruisin for a bruisin' through exception city object1.Visible.. true object2.Visible false becomes private void DoGUISwitch if object1.InvokeRequired object1.Invoke new MethodInvoker.. if object1.InvokeRequired object1.Invoke new MethodInvoker DoGUISwitch else object1.Visible true object2.Visible false This..

Casting vs using the 'as' keyword in the CLR

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

public class MyClass IMyInterface public void AMethod Do work Other helper methods.... public class Implementation IMyInterface.. answer have really explained where it's worth using which. Don't do this Bad code checks type twice for no reason if randomObject.. is TargetType TargetType foo TargetType randomObject Do something with foo Not only is this checking twice but it may..

When to use struct in C#?

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

16 bytes. A struct should not be changed after creation. Do these rules work What does a struct mean semantically c# struct.. short lived or are commonly embedded in other objects. Do not define a structure unless the type has all of the following.. type can be found at MSDN Structure Design . In short Do not provide a default constructor for a structure. If a structure..

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

IDisposable using var client new SomeWCFServiceClient Do something with the client But as noted in this MSDN article..

How to use HTML Agility pack

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

c# html html agility pack share improve this question Download and build the HTMLAgilityPack solution. In your application.. bin folder. Then as an example HtmlAgilityPack.HtmlDocument htmlDoc new HtmlAgilityPack.HtmlDocument There are various.. Then as an example HtmlAgilityPack.HtmlDocument htmlDoc new HtmlAgilityPack.HtmlDocument There are various options..

Nullable types and the ternary operator: why is `? 10 : null` forbidden? [duplicate]

http://stackoverflow.com/questions/858080/nullable-types-and-the-ternary-operator-why-is-10-null-forbidden

I just came across a weird error private bool GetBoolValue Do some logic and return true or false Then in another method something..

C# Finalize/Dispose pattern

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

use the using statement using myClass objClass new myClass Do stuff here I have developed this simple code below to demonstrate.. WebClient wc null public NoGateway wc new WebClient wc.DownloadStringCompleted wc_DownloadStringCompleted Start the Async.. NoGateway wc new WebClient wc.DownloadStringCompleted wc_DownloadStringCompleted Start the Async call to find if NoGateway..

How can I measure the similarity between 2 strings?

http://stackoverflow.com/questions/1034622/how-can-i-measure-the-similarity-between-2-strings

SOMEUSABLERETURNTYPE Compare string text1 string text2 DO SOMETHING HERE TO COMPARE Examples First String StackOverflow..

BUG: Cant choose dates on a DatePicker that fall outside a floating VSTO Add-In

http://stackoverflow.com/questions/10526118/bug-cant-choose-dates-on-a-datepicker-that-fall-outside-a-floating-vsto-add-in

a drop downlist that falls off the control but its events DO FIRE c# .net excel vsto datetimepicker share improve this..

DDD Approach to Access External Information

http://stackoverflow.com/questions/11241541/ddd-approach-to-access-external-information

AccountStatus Frozen public void AddInterest TO DO Balance need to be updated only if the person has no other accounts...

SetWindowsHookEx in C#

http://stackoverflow.com/questions/1811383/setwindowshookex-in-c-sharp

typeof Form1 .Module HERE IS THE PROBLEM. WHAT THE HECK DO I PASS INTO THE LAST 2 PARAMS I get a null pointer hHook SetWindowsHookEx..

XML Serialization and Inherited Types

http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types

a lot people EDIT One thing I should also add is that I DO NOT want to go down the XmlInclude route.. There is simply too.. Data get return _data set _data value summary DO NOT USE This is only added to enable XML Serialization. summary.. is only added to enable XML Serialization. summary remarks DO NOT USE THIS CONSTRUCTOR remarks public AbstractXmlSerializer..

String was not recognized as a valid DateTime “ format dd/MM/yyyy”

http://stackoverflow.com/questions/2193012/string-was-not-recognized-as-a-valid-datetime-format-dd-mm-yyyy

override which asks for IFormatProvider . What is this DO I need to pass this also. If Yes how to use it for this case..

“Treat all warnings as errors except…” in Visual Studio

http://stackoverflow.com/questions/267168/treat-all-warnings-as-errors-except-in-visual-studio

warnings. There is an option to suppress warnings but we DO want them to show up as warnings so that won't work. It appears.. the build to be broken for that long but you definitely DO want to see a warning about it. This isn't just a hypothetical..

What can C# do that VB.NET can't? [closed]

http://stackoverflow.com/questions/4701012/what-can-c-sharp-do-that-vb-net-cant

some advantages over Visual Basic and at that time C could DO things that Visual Basic could not. Is this true when we compare..

How does DataAnnotations really work in MVC?

http://stackoverflow.com/questions/5154231/how-does-dataannotations-really-work-in-mvc

work out together with the jQuery Validation plugin. YOU DO NOT Change the javascript ... that's sooo 90's and not MVC way..

Does Entity Framework 4 Code First have support for identity generators like NHibernate?

http://stackoverflow.com/questions/5275306/does-entity-framework-4-code-first-have-support-for-identity-generators-like-nhi

example public class Context DbContext Helper for example DO NOT USE IN REAL SCENARIOS private static int i 0 public DbSet..

Inherit List<T>

http://stackoverflow.com/questions/5376203/inherit-listt

by the framework design guidelines more specifically DO NOT use ArrayList List T Hashtable or Dictionary K V in public..

How to use WPF Background Worker

http://stackoverflow.com/questions/5483565/how-to-use-wpf-background-worker

void InitializationThread outputMessage Initializing... DO INITIALIZATION outputMessage Initialization Complete I have..

How to trigger event when a variable's value is changed?

http://stackoverflow.com/questions/5842339/how-to-trigger-event-when-a-variables-value-is-changed

_myProperty set _myProperty value if _myProperty 1 DO SOMETHING HERE This allows you to run some code any time the..

Compression/Decompression string with C#

http://stackoverflow.com/questions/7343465/compression-decompression-string-with-c-sharp

Compress sw.Write byteArray 0 byteArray.Length Close DO NOT FLUSH cause bytes will go missing... sw.Close Transform..

Why catch and rethrow Exception in C#?

http://stackoverflow.com/questions/881473/why-catch-and-rethrow-exception-in-c

to summarise for anyone who finds this thread in future... DO NOT try do stuff that might throw an exception catch Exception.. be crucial to identifying the root cause of the problem DO try do stuff that might throw an exception catch SqlException..