457
votes
31answers
321k views

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

What is the best tool for creating an Excel Spreadsheet with C#? Ideally, I would like open source so I don't have to add any third party dependencies to my code, and I would like to avoid using ...
134
votes
10answers
192k views

Encrypt/Decrypt string in .NET

Can someone give me the code to Encrypt and Decrypt a string in C#?
487
votes
17answers
254k views

Deep cloning objects in C#

I want to do something like: myObject myObj = GetmyObj(); //Create and fill a new object myObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the ...
259
votes
8answers
136k views

Sending email in .NET through Gmail

Instead of relying on my host to send email, I was thinking of sending the messages though my Gmail account. The emails are personalized emails to the bands I play on my show. Is it possible to do?
541
votes
37answers
124k views

How do I calculate someone's age

Given a DateTime representing a person's birthday, how do I calculate their age?
264
votes
0answers
56k views

String vs string in C# [duplicate]

Possible Duplicate: In C# what is the difference between String and string In C# the string keyword (highlighted in Visual Studio as a data type) is just a shortcut to the String class ...
91
votes
10answers
30k views

Creating a blocking Queue<T> in .NET?

I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size all threads that are filling the queue will be ...
151
votes
11answers
90k views

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

I want a true deep copy. In Java, this was easy, but how do you do it in C#?
177
votes
14answers
64k views

Deserialize JSON into C# dynamic object?

Is there a way to deserialize JSON content into a C# 4 dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
113
votes
0answers
60k views

Looking for C# HTML parser [duplicate]

Possible Duplicate: What is the best way to parse html in C#? I would like to extract the structure of the HTML document - so the tags are more important than the content. Ideally, it ...
146
votes
6answers
62k views

How to force my .NET App to run as administrator on Windows 7?

Once my program is installed on a client machine, how to force my program to run as administrator on Windows 7?
455
votes
10answers
125k views

What is the difference between Decimal, Float and Double in C#?

What is the difference between Decimal, Float and Double in C#? When would someone use one of these?
472
votes
6answers
34k views

Should Usings be inside or outside the namespace

I have been running StyleCop over some C# code and it keeps reporting that my using statements should be inside the namespace. Is there a technical reason for putting the using statements inside ...
158
votes
20answers
36k views

What is the correct way to create a single instance application?

Using C# and WPF under .net (rather than WindowsForms or console), what is the correct way to create an application that can only be run as a single instance? I know it has something to do with some ...
533
votes
21answers
122k views

Best way to parse command line arguments in C#? [closed]

When building console applications that take parameters, you can use the arguments passed to Main(string[] args). In the past I've simply indexed/looped that array and done a few regular expressions ...

1 2 3 4 5 872
15 30 50 per page