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
692
votes
8 answers

Calculate the execution time of a method

Possible Duplicate: How do I measure how long a function is running? I have an I/O time-taking method which copies data from a location to another. What's the best and most real way of calculating the execution time? Thread? Timer? Stopwatch? Any…
Mahdi Tahsildari
  • 13,065
  • 14
  • 55
  • 94
687
votes
10 answers

How do you do a deep copy of an object in .NET?

I want a true deep copy. In Java, this was easy, but how do you do it in C#?
user18931
  • 10,715
  • 9
  • 28
  • 21
686
votes
7 answers

Func delegate with no return type

All of the Func delegates return a value. What are the .NET delegates that can be used with methods that return void?
Marcel Lamothe
  • 12,452
  • 9
  • 34
  • 44
682
votes
13 answers

C# Interfaces. Implicit implementation versus Explicit implementation

What are the differences in implementing interfaces implicitly and explicitly in C#? When should you use implicit and when should you use explicit? Are there any pros and/or cons to one or the other? Microsoft's official guidelines (from first…
Seb Nilsson
  • 26,200
  • 30
  • 103
  • 130
672
votes
41 answers

How do I make a textbox that only accepts numbers?

I have a windows forms app with a textbox control that I want to only accept integer values. In the past I've done this kind of validation by overloading the KeyPress event and just removing characters which didn't fit the specification. I've looked…
Mykroft
  • 13,077
  • 13
  • 44
  • 72
664
votes
11 answers

Best way to get application folder path

I see that there are some ways to get the application folder…
Leo Vo
  • 9,980
  • 9
  • 56
  • 78
662
votes
15 answers

In WPF, what are the differences between the x:Name and Name attributes?

Sometimes it seems that the Name and x:Name attributes are interchangeable. So, what are the definitive differences between them, and when is it preferable to use one over the other? Are there any performance or memory implications to using them the…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
657
votes
14 answers

How do I use WPF bindings with RelativeSource?

How do I use RelativeSource with WPF bindings and what are the different use-cases?
David Schmitt
  • 58,259
  • 26
  • 121
  • 165
657
votes
16 answers

Declare a const array

Is it possible to write something similar to the following? public const string[] Titles = { "German", "Spanish", "Corrects", "Wrongs" };
Jaime Oro
  • 9,899
  • 8
  • 31
  • 39
645
votes
10 answers

C# "internal" access modifier when doing unit testing

I'm trying to figure out if I should start using more of internal access modifier. I know that if we use internal and set the assembly variable InternalsVisibleTo, we can test functions that we don't want to declare public from the testing…
Hertanto Lie
  • 8,832
  • 7
  • 28
  • 27
642
votes
10 answers

How do I get the directory from a file's full path?

What is the simplest way to get the directory that a file is in? I'm using this to set a working directory. string filename = @"C:\MyDirectory\MyFile.bat"; In this example, I should get "C:\MyDirectory".
Even Mien
  • 44,393
  • 43
  • 115
  • 119
640
votes
10 answers

What are the true benefits of ExpandoObject?

The ExpandoObject class being added to .NET 4 allows you to arbitrarily set properties onto an object at runtime. Are there any advantages to this over using a Dictionary, or really even a Hashtable? As far as I can tell, this is…
Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
638
votes
28 answers

Comparing two byte arrays in .NET

How can I do this fast? Sure I can do this: static bool ByteArrayCompare(byte[] a1, byte[] a2) { if (a1.Length != a2.Length) return false; for (int i=0; i
Hafthor
  • 16,358
  • 9
  • 56
  • 65
635
votes
9 answers

What does a lock statement do under the hood?

I see that for using objects which are not thread safe we wrap the code with a lock like this: private static readonly Object obj = new Object(); lock (obj) { // thread unsafe code } So, what happens when multiple threads access the same code…
NLV
  • 21,141
  • 40
  • 118
  • 183
633
votes
18 answers

How can I find the method that called the current method?

When logging in C#, how can I learn the name of the method that called the current method? I know all about System.Reflection.MethodBase.GetCurrentMethod(), but I want to go one step beneath this in the stack trace. I've considered parsing the stack…
flipdoubt
  • 13,897
  • 15
  • 64
  • 96