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

How to compare Unicode characters that "look alike"?

I fall into a surprising issue. I loaded a text file in my application and I have some logic which compares the value having µ. And I realized that even if the texts are same the compare value is false. Console.WriteLine("μ".Equals("µ")); //…
D J
  • 6,418
  • 10
  • 38
  • 73
97
votes
10 answers

How can I catch a 404?

I have the following code: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "HEAD"; request.Credentials = MyCredentialCache; try { request.GetResponse(); } catch { } How can I catch a specific 404 error? The…
JL.
  • 71,902
  • 119
  • 298
  • 446
97
votes
4 answers

LINQ to Entities only supports casting EDM primitive or enumeration types with IEntity interface

I have the following generic extension method: public static T GetById(this IQueryable collection, Guid id) where T : IEntity { Expression> predicate = e => e.Id == id; T entity; // Allow reporting more…
Steven
  • 151,500
  • 20
  • 287
  • 393
97
votes
6 answers

How do I get the MAX row with a GROUP BY in LINQ query?

I am looking for a way in LINQ to match the follow SQL Query. Select max(uid) as uid, Serial_Number from Table Group BY Serial_Number Really looking for some help on this one. The above query gets the max uid of each Serial Number because of the…
SpoiledTechie.com
  • 9,951
  • 19
  • 73
  • 98
97
votes
7 answers

How do I get rid of "[some event] never used" compiler warnings in Visual Studio?

For example, I get this compiler warning, The event 'Company.SomeControl.SearchClick' is never used. But I know that it's used because commenting it out throws me like 20 new warnings of XAML pages that are trying to use this event! What gives? Is…
jedmao
  • 9,166
  • 9
  • 51
  • 63
96
votes
4 answers

Insert data using Entity Framework model

I'm trying to insert some data in my database using Entity Framework model, but for some unknown reasons to me, it does nothing. Am I missing something here? using (var context = new DatabaseEntities()) { var t = new test { ID =…
Rocshy
  • 3,097
  • 10
  • 33
  • 51
96
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
  • 20,773
  • 11
  • 80
  • 114
96
votes
10 answers

Capture console exit C#

I have a console application that contains quite a lot of threads. There are threads that monitor certain conditions and terminate the program if they are true. This termination can happen at any time. I need an event that can be triggered when…
ZeroKelvin
  • 1,863
  • 2
  • 15
  • 9
96
votes
5 answers

Linq Query keeps throwing "Unable to create a constant value of type System.Object....", Why?

The following is the code sample: private void loadCustomer(int custIdToQuery) { var dbContext = new SampleDB(); try { var customerContext = from t in dbContext.tblCustomers // keeps throwing: …
Neel
  • 1,771
  • 2
  • 18
  • 30
96
votes
15 answers

What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?

When executing SubmitChanges to the DataContext after updating a couple properties with a LINQ to SQL connection (against SQL Server Compact Edition) I get a "Row not found or changed." ChangeConflictException. var ctx = new…
Kevin
  • 9,077
  • 11
  • 41
  • 51
96
votes
40 answers

Nuget connection attempt failed "Unable to load the service index for source"

While trying to connect to Nuget, I'm getting the error below, and then I am unable to connect: [nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. Unable to…
DarthVader
  • 46,241
  • 67
  • 190
  • 289
96
votes
5 answers

Getting Date or Time only from a DateTime Object

I have a DateTime instance that has a Date and a Time. How do I extract only the date or only the time?
Luke
  • 5,150
  • 10
  • 46
  • 76
96
votes
4 answers

How to redirect to a dynamic login URL in ASP.NET MVC

I'm creating a multi-tenancy web site which hosts pages for clients. The first segment of the URL will be a string which identifies the client, defined in Global.asax using the following URL routing…
96
votes
16 answers

Is there a string math evaluator in .NET?

If I have a string with a valid math expression such as: String s = "1 + 2 * 7"; Is there a built in library/function in .NET that will parse and evaluate that expression for me and return the result? In this case 15.
Guy
  • 59,547
  • 93
  • 241
  • 306
96
votes
7 answers

GetFiles with multiple extensions

Possible Duplicate: Can you call Directory.GetFiles() with multiple filters? How do you filter on more than one extension? I've tried: FileInfo[] Files = dinfo.GetFiles("*.jpg;*.tiff;*.bmp"); FileInfo[] Files =…
rd42
  • 3,378
  • 14
  • 52
  • 67