Skip to main content
Filter by
Sorted by
Tagged with
1866 votes
26 answers
2.5m views

I have some code and when it executes, it throws a NullReferenceException, saying: Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?
1607 votes
47 answers
859k views

Which is the simplest way to update a Label from another Thread? I have a Form running on thread1, and from that I'm starting another thread (thread2). While thread2 is processing some files I would ...
CruelIO's user avatar
  • 18.7k
1693 votes
25 answers
308k views

In .NET, the GetHashCode method is used in a lot of places throughout the .NET base class libraries. Implementing it properly is especially important to find items quickly in a collection or when ...
bitbonk's user avatar
  • 49.9k
1204 votes
30 answers
1.2m views

Is there a way to deserialize JSON content into a C# dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
jswanson's user avatar
  • 16.5k
2191 votes
49 answers
1.4m views

How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?
1006 votes
21 answers
747k views

I'm writing a program in C# that needs 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 file before it's been saved back to ...
Dawsy's user avatar
  • 10.6k
1424 votes
26 answers
1.3m views

From my understanding one of the main things that async and await do is to make code easy to write and read - but is using them equal to spawning background threads to perform long duration logic? I'...
Dan Dinu's user avatar
  • 33.5k
1500 votes
17 answers
2.6m views

How can I make an HTTP POST request and send data in the body?
Hooch's user avatar
  • 29.8k
756 votes
29 answers
845k views

How can I encrypt and decrypt a string in C#?
NotDan's user avatar
  • 32.3k
21 votes
2 answers
43k views

Let's discuss following topic. There is application which currently is being deployed with good to know xcopy method.This approach makes difficult to manage dependencies, file updates etc. There is ...
Vadym Fedorov's user avatar
408 votes
10 answers
83k views

Is there any scenario where writing method like this: public async Task<SomeResult> DoSomethingAsync() { // Some synchronous code might or might not be here... // return await ...
TX_'s user avatar
  • 5,526
117 votes
17 answers
118k views

Some guy asked me this question couple of months ago and I couldn't explain it in detail. What is the difference between a reference type and a value type in C#? I know that value types are int, bool,...
tugberk's user avatar
  • 58.7k
203 votes
2 answers
67k views

Consider the below code: public class Class1 { public static int c; ~Class1() { c++; } } public class Class2 { public static void Main() { { var c1=...
Victor Mukherjee's user avatar
373 votes
30 answers
347k views

What profilers have you used when working with .net programs, and which would you particularly recommend?
7595 votes
67 answers
1.4m views

What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!";
872 votes
24 answers
872k views

How do I read an embedded resource (text file) using StreamReader and return it as a string? My current script uses a Windows form and textbox that allows the user to find and replace text in a text ...
Me.Close's user avatar
  • 8,771
849 votes
30 answers
2.2m views

I have a TextBoxD1.Text and I want to convert it to an int to store it in a database. How can I do this?
turki2009's user avatar
  • 8,567
567 votes
25 answers
339k views

I'm trying to convert some strings that are in French Canadian and basically, I'd like to be able to take out the French accent marks in the letters while keeping the letter. (E.g. convert é to e, so ...
James Hall's user avatar
  • 6,729
243 votes
22 answers
428k views

I'm a C#/Windows Forms programmer with more than 5 years experience. I've been investigating WPF using the MVVM (Model-View-ViewModel) design pattern. I have searched the Internet for tutorials. I ...
JP Richardson's user avatar
58 votes
3 answers
55k views

I saw this post: Typos… Just use option strict and explicit please.. during one software development project, which I was on as a consultant, they were getting ridiculous amounts of errors ...
yretuta's user avatar
  • 8,141
736 votes
20 answers
472k views

I have a condition in a silverlight application that compares 2 strings, for some reason when I use == it returns false while .Equals() returns true. Here is the code: if (((ListBoxItem)lstBaseMenu....
Drahcir's user avatar
  • 12.7k
594 votes
18 answers
351k views

I am new to asynchronous programming with the async modifier. I am trying to figure out how to make sure that my Main method of a console application actually runs asynchronously. class Program { ...
danielovich's user avatar
  • 9,727
731 votes
18 answers
532k views

Is it possible to embed a pre-existing DLL into a compiled C# executable (so that you only have one file to distribute)? If it is possible, how would one go about doing it? Normally, I'm cool with ...
Merus's user avatar
  • 8,994
13 votes
2 answers
20k views

I have following C# code in a console application. Whenever I debug the application and run the query1 (which inserts a new value into the database) and then run query2 (which displays all the ...
Joe Slater's user avatar
  • 2,483
46 votes
2 answers
22k views

In my company the common way to release Excel Interop Objects is to use IDisposable the following way: Public Sub Dispose() Implements IDisposable.Dispose If Not bolDisposed Then Finalize(...
ruedi's user avatar
  • 5,615

1
2 3 4 5
1015