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
1172
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
  • 29,307
  • 34
  • 118
  • 188
1168
votes
12 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 it outputs the string foo {0}. Is there a way to escape the brackets?
Pop Catalin
  • 61,751
  • 23
  • 87
  • 115
1140
votes
22 answers

LINQ query on a DataTable

I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example: var results = from myRow in myDataTable where results.Field("RowNo") == 1 select…
Calanus
  • 25,619
  • 25
  • 85
  • 120
1135
votes
16 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 memcopy,…
BCS
  • 75,627
  • 68
  • 187
  • 294
1126
votes
30 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
  • 11,993
  • 3
  • 23
  • 18
1079
votes
13 answers

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

In ASP.NET MVC, what is the difference between: Html.Partial and Html.RenderPartial Html.Action and Html.RenderAction
Ghooti Farangi
  • 19,926
  • 15
  • 46
  • 61
1072
votes
10 answers

DateTime vs DateTimeOffset

What is the difference between a DateTime and a DateTimeOffset and when should one be used? Currently, we have a standard way of dealing with .NET DateTimes in a TimeZone-aware way: Whenever we produce a DateTime we do it in UTC (e.g. using…
David Reis
  • 12,701
  • 7
  • 36
  • 42
1048
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
  • 11,732
  • 2
  • 19
  • 15
1028
votes
23 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. Would String.Format() be the correct path to take? What format would I use?
Seibar
  • 68,705
  • 38
  • 88
  • 99
1012
votes
21 answers

Best way to repeat a character in C#

What is 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
  • 48,865
  • 44
  • 102
  • 150
1009
votes
13 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
  • 28,163
  • 29
  • 106
  • 188
979
votes
12 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
  • 60,526
  • 100
  • 215
  • 315
970
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
  • 10,249
  • 5
  • 20
  • 13
963
votes
17 answers

split a string on newlines in .NET

I need to split a string into newlines in .NET and the only way I know of to split strings is with the Split method. However that will not allow me to (easily) split on a newline, so what is the best way to do it?
RCIX
  • 38,647
  • 50
  • 150
  • 207
959
votes
26 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
  • 20,959
  • 28
  • 93
  • 149