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
1053
votes
10 answers

How to escape braces (curly brackets) in a format string in .NET

How can brackets be escaped in using string.Format. For example: String val = "1,2,3" String.Format(" foo {{0}}", val); This example doesn't throw an exception, but outputs the string foo {0}. Is there a way to escape the brackets?
Pop Catalin
  • 57,418
  • 22
  • 86
  • 111
1053
votes
14 answers

Group By Multiple Columns

How can I do GroupBy multiple columns in LINQ Something similar to this in SQL: SELECT * FROM GROUP BY , How can I convert this to LINQ: QuantityBreakdown ( MaterialID int, ProductID int, Quantity…
Sreedhar
  • 26,251
  • 31
  • 104
  • 163
1048
votes
28 answers

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.
jswanson
  • 14,964
  • 6
  • 18
  • 15
1023
votes
27 answers

How can I get the application's path in a .NET console application?

How do I find the application's path in a console application? In Windows Forms, I can use Application.StartupPath to find the current path, but this doesn't seem to be available in a console application.
JSmyth
  • 10,945
  • 3
  • 21
  • 18
1018
votes
55 answers

Could not find a part of the path ... bin\roslyn\csc.exe

I am trying to run Asp.net MVC project retrieved from TFS source control. I have added all assembly references and I am able to build and compile successfully without any error or warning. But I get the following error in the browser: Could not…
Eyad
  • 11,082
  • 5
  • 24
  • 41
1001
votes
15 answers

How to convert UTF-8 byte[] to string?

I have a byte[] array that is loaded from a file that I happen to known contains UTF-8. In some debugging code, I need to convert it to a string. Is there a one liner that will do this? Under the covers it should be just an allocation and a…
BCS
  • 67,242
  • 64
  • 175
  • 277
969
votes
1 answer

Escape curly brace '{' in String.Format

How do I display a literal curly brace character when using the String.Format method? Example: sb.AppendLine(String.Format("public {0} {1} { get; private set; }", prop.Type, prop.Name)); I would like the output to look like this: public Int32…
PhilB
  • 10,903
  • 2
  • 17
  • 14
918
votes
14 answers

How do I force my .NET application to run as administrator?

Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?
Gold
  • 54,738
  • 95
  • 206
  • 310
917
votes
12 answers

What is the difference between .NET Core and .NET Standard Class Library project types?

In Visual Studio, there are at least three different types of class libraries you can create: Class Library (.NET Framework) Class Library (.NET Standard) Class Library (.NET Core) While the first is what we've been using for years, a major point…
Gigi
  • 24,295
  • 20
  • 85
  • 170
911
votes
22 answers

Sending email in .NET through Gmail

Instead of relying on my host to send an email, I was thinking of sending the email messages using my Gmail account. The emails are personalized emails to the bands I play on my show. Is it possible to do it?
Mike Wills
  • 19,825
  • 26
  • 87
  • 143
911
votes
22 answers

.NET String.Format() to add commas in thousands place for a number

I want to add a comma in the thousands place for a number. String.Format()?
Seibar
  • 63,705
  • 37
  • 85
  • 98
892
votes
20 answers

Is there a way to check if a file is in use?

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 the filesystem and throw an error: "File in use by…
Dawsy
  • 9,429
  • 4
  • 18
  • 13
886
votes
7 answers

What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion?

There are three assembly version attributes. What are differences? Is it ok if I use AssemblyVersion and ignore the rest? MSDN says: AssemblyVersion: Specifies the version of the assembly being attributed. AssemblyFileVersion: Instructs a…
Jakub Šturc
  • 32,938
  • 24
  • 85
  • 107
879
votes
20 answers

Best way to repeat a character in C#

What it's the best way to generate a string of \t's in C# I am learning C# and experimenting with different ways of saying the same thing. Tabs(uint t) is a function that returns a string with t amount of \t's For example Tabs(3) returns…
Alex Baranosky
  • 44,548
  • 39
  • 95
  • 146
871
votes
14 answers

When to use .First and when to use .FirstOrDefault with LINQ?

I've searched around and haven't really found a clear answer as to when you'd want to use .First and when you'd want to use .FirstOrDefault with LINQ. When would you want to use .First? Only when you'd want to catch the exception if no results…
Metro Smurf
  • 33,866
  • 20
  • 97
  • 127