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

Latest stable release

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)
  • OpenWrap - Sebastien Lambla - Open Source Dependency Manager for .NET applications

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

Social Media

  • LINQ to Twitter - LINQ-based wrapper for all Twitter API functionality in C#
  • Facebook C# SDK - A toolkit for creating Facebook applications / integrating websites with Facebook using the new Graph API or the old rest API.

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

  • CSLA Framework - Business Objects Framework
  • Prism - Composite UI application block for WPF, Silverlight and Windows Phone 7 - Microsoft patterns & practices
  • Enterprise Library 5.0 - Logging, Exception Management, Caching, Cryptography, Data Access, Validation, Security, Policy Injection - Microsoft patterns & practices
  • File helpers library
  • C5 Collections - Collections for .NET
  • Quartz.NET - Enterprise Job Scheduler for .NET Platform
  • MiscUtil - Utilities by Jon Skeet
  • Noda Time - DateTime replacement (idiomatic port of Joda Time from Java)
  • Lucene.net - Text indexing and searching
  • Json.NET - LINQ over JSON
  • Flee - expression evaluator
  • PostSharp - AOP
  • IKVM - brings the extensive world of Java libraries to .NET.
  • C# Webserver - Embeddable webserver
  • Long Path - Microsoft
  • .NET Engines for the GOLD Parsing System
  • Smart Thread Pool - Thread Pool management library
  • NCQRS - library for event-driven architectures (CQRS).
  • NBug - Automated exception and error reporting tool (can generate minidumps)
  • Splicer.Net - library for the .NET Framework that aims to simplify developing applications for editing and encoding audio and video using DirectShow.
  • Pex - a tool for automatic test case generation
  • Lidgren Network - a networking library for .NET Framework which uses a single UDP socket to deliver a simple API for connecting a client to a server, reading and sending messages.
  • LINQPad - Scripting IDE for C# / VB / SQL with emphasis on LINQ to databases
308270 questions
6903
votes
62 answers

What is the difference between String and string in C#?

Example (note the case): string s = "Hello world!"; String s = "Hello world!"; What are the guidelines for the use of each? And what are the differences?
Lance Fisher
  • 25,328
  • 20
  • 91
  • 121
4012
votes
32 answers

How to enumerate an enum

How can you enumerate an enum in C#? E.g. the following code does not compile: public enum Suit { Spades, Hearts, Clubs, Diamonds } public void EnumerateAllSuitsDemoMethod() { foreach (Suit suit in Suit) { …
Ian Boyd
  • 220,884
  • 228
  • 805
  • 1,125
2674
votes
12 answers

What are the correct version numbers for C#?

What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5? This question is primarily to aid those who are searching for an answer using an incorrect version number, e.g. C# 3.5. The hope is that…
Jon Skeet
  • 1,261,211
  • 792
  • 8,724
  • 8,929
2387
votes
50 answers

Deep cloning objects

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 original object. I don't often need this functionality,…
NakedBrunch
  • 45,899
  • 13
  • 69
  • 97
2308
votes
28 answers

Catch multiple exceptions at once?

It is discouraged to simply catch System.Exception. Instead, only the "known" exceptions should be caught. Now, this sometimes leads to unnecessary repetitive code, for example: try { WebId = new Guid(queryString["web"]); } catch…
Michael Stum
  • 167,397
  • 108
  • 388
  • 523
2265
votes
40 answers

How do I get a consistent byte representation of strings in C# without manually specifying an encoding?

How do I convert a string to a byte[] in .NET (C#) without manually specifying a specific encoding? I'm going to encrypt the string. I can encrypt it without converting, but I'd still like to know why encoding comes to play here. Also, why should…
Agnel Kurian
  • 53,593
  • 39
  • 135
  • 210
2193
votes
12 answers

Should 'using' directives be inside or outside the namespace?

I have been running StyleCop over some C# code, and it keeps reporting that my using directives should be inside the namespace. Is there a technical reason for putting the using directives inside instead of outside the namespace?
benPearce
  • 34,921
  • 14
  • 60
  • 93
2192
votes
18 answers

Difference between decimal, float and double in .NET?

What is the difference between decimal, float and double in .NET? When would someone use one of these?
Tom
2014
votes
64 answers

How do I calculate someone's age based on a DateTime type birthday?

Given a DateTime representing a person's birthday, how do I calculate their age in years?
Jeff Atwood
  • 60,897
  • 45
  • 146
  • 152
1995
votes
46 answers

How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?

How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?
mistrmark
  • 4,349
  • 6
  • 20
  • 15
1874
votes
28 answers

What is a NullReferenceException, and how do I fix it?

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?
John Saunders
  • 157,405
  • 24
  • 229
  • 388
1749
votes
118 answers

How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?

A C# desktop application on the express edition worked, but then it didn't work 5 seconds later. I tried the following: Ensure debug configuration, debug flag, and full debug information are set on all assemblies. Delete all bin and obj folders and…
Instance Hunter
  • 7,621
  • 5
  • 39
  • 52
1743
votes
20 answers

Proper use of the IDisposable interface

I know from reading the Microsoft documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources. To me, "unmanaged" means things like database connections, sockets, window handles, etc. But, I've seen code…
cwick
  • 24,336
  • 12
  • 35
  • 40
1647
votes
12 answers

Calling the base constructor in C#

If I inherit from a base class and want to pass something from the constructor of the inherited class to the constructor of the base class, how do I do that? For example, if I inherit from the Exception class I want to do something like this: class…
lomaxx
  • 104,787
  • 56
  • 140
  • 177
1586
votes
8 answers

How to loop through all enum values in C#?

This question already has an answer here: How do I enumerate an enum in C#? 26 answers public enum Foos { A, B, C } Is there a way to loop through the possible values of Foos? Basically? foreach(Foo in Foos)
divinci
  • 20,239
  • 11
  • 42
  • 56
1
2 3
99 100