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
96
votes
17 answers

A reference to the dll could not be added

When I add a .dll file as a reference in C# application it shows an error : A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component. ILDissassembler says…
user20358
  • 12,976
  • 29
  • 106
  • 174
96
votes
8 answers

Get output parameter value in ADO.NET

My stored procedure has an output parameter: @ID INT OUT How can I retrieve this using ado.net? using (SqlConnection conn = new SqlConnection(...)) { SqlCommand cmd = new SqlCommand("sproc", conn); cmd.CommandType =…
Blankman
96
votes
3 answers

Convert object of any type to JObject with Json.NET

I often need to extend my Domain model with additional info before returning it to the client with WebAPI. To avoid creation of ViewModel I thought I could return JObject with additional properties. I could not however find direct way to convert…
dragonfly
  • 16,119
  • 28
  • 99
  • 199
96
votes
6 answers

How to Get a Sublist in C#

I have a List and i need to take a sublist out of this list. Is there any methods of List available for this in .NET 3.5?
Thomas Manalil
  • 1,447
  • 3
  • 14
  • 22
96
votes
6 answers

What is your favorite date and time format in a file name?

This is a somewhat subjective question, and not very important in the big scheme of things, but something that yet annoys me regularly. There seems to be no self-evident way to put a timestamp in a file name. Objective issue is that timestamps in…
mika
  • 6,404
  • 2
  • 33
  • 38
96
votes
10 answers

Anything wrong with NOT signing a .NET assembly?

One of my colleagues is very keen on signing assemblies. He literally tries to sign anything. Even when we use assemblies from Microsoft that are not signed, he will take the source code, sign it and then ask other developers to use his copy…
oscarkuo
  • 10,155
  • 6
  • 46
  • 61
96
votes
11 answers

Checking if an object is a number in C#

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
  • 23,150
  • 23
  • 90
  • 120
95
votes
12 answers

What is the real overhead of try/catch in C#?

So, I know that try/catch does add some overhead and therefore isn't a good way of controlling process flow, but where does this overhead come from and what is it's actual impact?
JC Grubbs
  • 34,411
  • 27
  • 64
  • 74
95
votes
8 answers

C# naming convention for enum and matching property

I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict? public class Car { public enum Status { …
Serge Wautier
  • 20,382
  • 13
  • 63
  • 104
95
votes
2 answers

How should I inject a DbContext instance into an IHostedService?

Question How should I inject (using the standard dependency injection) a DbContext instance into a IHostedService? What have I tried I currently have my IHostedService class take a MainContext (deriving from DbContext) instance in the…
Shoe
  • 70,092
  • 30
  • 150
  • 251
95
votes
8 answers

A property or indexer may not be passed as an out or ref parameter

I am getting the above error and unable to resolve it. I googled a bit but can't get rid of it. Scenario: I have class BudgetAllocate whose property is budget which is of double type. In my dataAccessLayer, In one of my classes I am trying to do…
Pratik
  • 10,748
  • 21
  • 64
  • 98
95
votes
7 answers

internal vs public in C#

I want to know the difference between the public and internal visibility modifiers. When should we use internal on a class and when public? I am confused with when a method should be public or internal. I read that internal can be accessed through…
NoviceToDotNet
  • 9,183
  • 28
  • 103
  • 158
95
votes
4 answers

Roslyn failed to compile code

After I have migrated my project from VS2013 to VS2015 the project no longer builds. A compilation error occurs in the following LINQ statement: static void Main(string[] args) { decimal a, b; IEnumerable array = new string[] {…
ramil89
  • 851
  • 11
  • 21
95
votes
3 answers

How to catch SqlException caused by deadlock?

From a .NET 3.5 / C# app, I would like to catch SqlException but only if it is caused by deadlocks on a SQL Server 2008 instance. Typical error message is Transaction (Process ID 58) was deadlocked on lock resources with another process and has…
Joannes Vermorel
  • 8,551
  • 10
  • 60
  • 95
95
votes
2 answers

"application/json" constant in .NET framework

I've just declared a constant for the "application/json" content type in one of my classes. public const string JsonContentType = "application/json"; I'm not sure it is a good practice. Does .NET framework have a predefined const for…
Maxim Eliseev
  • 2,630
  • 2
  • 25
  • 33
1 2 3
99
100