Questions tagged [.net]

Do NOT use for questions about .NET Core - use [.net-core] instead. The .NET framework is a software framework designed mainly for the Microsoft Windows operating system. It includes an implementation of the Base Class Library, Common Language Runtime (commonly referred to as CLR), Common Type System (commonly referred to as CTS) and Dynamic Language Runtime. It supports many programming languages, including C#, VB.NET, F# and C++/CLI.

The .NET Framework is not specific to any programming language. Programming languages from Microsoft, like , , CLI, and , as well as many other languages from other vendors, all use the same .NET Framework.

The .NET Framework includes a large library of functions as part of the Base Class Library (BCL), including those related to user interface design, data access, database connectivity, cryptography, development of web applications, mathematical algorithms, and network communications. This extensive library simplifies development and makes it easy to rapidly develop new applications.

As such, questions like "How do I do file I/O in C#?" should really be "How do I do file I/O with .NET?". Because such a question concerns the file I/O libraries provided by the .NET Framework, it should be tagged with both the tag, and with the tag, to indicate that you'd like the answer to be written in the C# programming language.

See also: , (do NOT use the tag for questions about .NET Core).

Getting help

Versions of .NET

Performance

Garbage collector

Free .NET Programming Books (C# / F# / VB / Nemerle / Visual Studio)

Reference Source

API Guide


Database

Database Drivers

  • MySQL Connector - Connector/Net is a fully-managed ADO.NET driver for MySQL
  • Npgsql - .NET data provider for PostgreSQL
  • MongoDB - Official MongoDB C# driver
  • RethinkDb.Driver - A RethinkDB database driver in C# striving for 100% ReQL API compatibility and completeness.
  • ServiceStack Redis - .NET's leading C# Redis client
  • StackExchange Redis - General purpose Redis client from Stack Exchange
  • Cassandra - DataStax .NET driver for Apache Cassandra
  • Couchbase - Official Couchbase .NET client library, based on the Enyim Memcached client
  • Firebird.NET - The .NET Data provider is written in C# and provides a high-performance, native implementation of the Firebird API

Useful .NET Libraries

Mathematics

  • Math.NET Numerics - special functions, linear algebra, probability models, random numbers, interpolation, integral transforms and more

Package managers for external libraries

  • NuGet (formerly known as NuPack) - Microsoft (developer-focused package management system for the .NET platform intent on simplifying the process of incorporating third-party libraries into a .NET application during development)

Build Tools

  • Prebuild - Generate project files for all Visual Studio versions, including major IDEs and tools like SharpDevelop, MonoDevelop, NAnt and Autotools

Dependency Injection/Inversion of Control

Logging

Validation

Design by Contract

Compression

Ajax

Data Mapper

ORM

Charting/Graphics

PDF Creators/Generators

Unit Testing/Mocking

Automated Web Testing

Misc Testing/Quality Support/Behavior Driven Development (BDD)

URL Rewriting

Web Debugging

  • Glimpse - Firebug for your webserver

Controls

MS Word/Excel Documents Manipulation

  • DocX to create, read, manipulate formatted word documents. Easy syntax, working nicely, actively developed. No Microsoft Office necessary.
  • Excel XML Writer allows creation of .XLS (Excel) files. No Microsoft Office necessary. It has been a while since it has been updated. It also provides a code generator to create code from already created XLS file (saved as XML). Haven't tested this but looks very promising. The author hasn't updated this in awhile.
  • Excel Reader allows creation/reading of .XLS (Excel) files. No Microsoft Office necessary. It has been awhile since it has been updated.
  • Excel Package allows creation/reading of .XLSX (Excel 2007) files. No Microsoft Office necessary. The author is gone, so it's out of date.
  • EPPlus is based on Excel Package and allows creation/reading of .XLSX (Excel 2007). It is actually the most advanced even comparing to NPOI.
  • NPOI is the .NET version of POI Java project at https://poi.apache.org/. POI is an open source project which can help you read/write Excel, Word, and PowerPoint files. Latest sources available at GitHub repository

Serialization

  • sharpSerializer - XML/binary serializer for WPF, ASP.NET AND Silverlight
  • protobuf-net - .NET implementation of Google's cross-platform binary serializer (for all .NET platforms)

Machine learning

  • Encog C# - Neural networks
  • AForge.net - AI, computer vision, genetic algorithms, machine learning

Chat room

Chat about .NET with other Stack Overflow users

RESTFul Web Services

  • RestSharp - Simple REST and HTTP API Client for .NET

Unclassified

333813 questions
110
votes
2 answers

Controls on Pivot disappear

I have an app with a pivot control. The pivot control has two items (pages), both contain a grid. The grids contain a few buttons and one a map and the other a text block. When the app first runs the pivot works as expected. However, after the app…
Jamie Kitson
  • 3,973
  • 4
  • 37
  • 50
110
votes
22 answers

How do I sort an observable collection?

I have a following class : [DataContract] public class Pair : INotifyPropertyChanged, IDisposable { public Pair(TKey key, TValue value) { Key = key; Value = value; } #region Properties [DataMember] …
Maciek
  • 19,435
  • 18
  • 63
  • 87
110
votes
8 answers

What's the best way of implementing a thread-safe Dictionary?

I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object: public class SafeDictionary: IDictionary { private readonly object syncRoot = new object(); …
GP.
  • 1,293
  • 5
  • 14
  • 20
110
votes
6 answers

Check if a property exists in a class

I try to know if a property exist in a class, I tried this : public static bool HasProperty(this object obj, string propertyName) { return obj.GetType().GetProperty(propertyName) != null; } I don't understand why the first test method does not…
TheBoubou
  • 19,487
  • 54
  • 148
  • 236
110
votes
11 answers

How can I join int[] to a character-separated string in .NET?

I have an array of integers: int[] number = new int[] { 2,3,6,7 }; What is the easiest way of converting these into a single string where the numbers are separated by a character (like: "2,3,6,7")? I'm using C# and .NET 3.5.
Riri
  • 11,501
  • 14
  • 63
  • 88
110
votes
16 answers

How to throw a SqlException when needed for mocking and unit testing?

I am trying to test some exceptions in my project and one of the Exceptions I catch is SQlException. It seems that you can't go new SqlException() so I am not sure how I can throw an exception especially without somehow calling the database (and…
chobo2
  • 83,322
  • 195
  • 530
  • 832
110
votes
9 answers

How did Microsoft create assemblies that have circular references?

In the .NET BCL there are circular references between: System.dll and System.Xml.dll System.dll and System.Configuration.dll System.Xml.dll and System.Configuration.dll Here's a screenshot from .NET Reflector that shows what I mean: How Microsoft…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
110
votes
15 answers

Checking if an object is a number

I'd like to check if an object is a number so that .ToString() would result in a string containing digits and +, -, . Is it possible by simple type checking in .NET? Like: if (p is Number) Or should I convert to string, then try parsing to…
Piotr Czapla
  • 25,734
  • 24
  • 99
  • 122
109
votes
18 answers

Combine two (or more) PDF's

Background: I need to provide a weekly report package for my sales staff. This package contains several (5-10) crystal reports. Problem: I would like to allow a user to run all reports and also just run a single report. I was thinking I could do…
Nathan Koop
  • 24,803
  • 25
  • 90
  • 125
109
votes
6 answers

SQLite equivalent to ISNULL(), NVL(), IFNULL() or COALESCE()

I'd like to avoid having many checks like the following in my code: myObj.someStringField = rdr.IsDBNull(someOrdinal) ? string.Empty : rdr.GetString(someOrdinal); I figured I could just have…
Jason Down
  • 21,731
  • 12
  • 83
  • 117
109
votes
22 answers

How to change the color of progressbar in C# .NET 3.5?

I'd like to do two things on my progress bar. Change the green colour to red. Remove the blocks and make it in one color. Any information about those two things I wonder how to accomplish will be greatfuly appreaciated! Thanks.
Ivan Prodanov
  • 34,634
  • 78
  • 176
  • 248
109
votes
2 answers

Regex to match more than 2 white spaces but not new line

I want to replace all more than 2 white spaces in a string but not new lines, I have this regex: \s{2,} but it is also matching new lines. How can I match 2 or more white spaces only and not new lines? I'm using c#
Bruno
  • 1,091
  • 2
  • 7
  • 3
109
votes
5 answers

Why is my process's Exited method not being called?

I have following code, but why is the ProcessExited method never called? It is the same if I don't a use Windows shell (startInfo.UseShellExecute = false). ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow =…
5YrsLaterDBA
  • 33,370
  • 43
  • 136
  • 210
109
votes
12 answers

What is the difference between List (of T) and Collection(of T)?

I've seen them used in a lot of the same ways, and I am worried I'm about to go down a path in design that is irreversible if I don't understand this better. Also, I am using .NET.
Anthony Potts
  • 8,842
  • 8
  • 41
  • 56
109
votes
4 answers

Cannot send a content-body with this verb-type

I just got this exception (ProtocolViolationException) in my .NET 2.0 app (running on windows mobile 6 standard emulator). What confuses me is that as far as i know, I have not added any content body, unless I've inadvertently done it somehow. My…
Brian Sweeney
  • 6,693
  • 14
  • 54
  • 69