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
112
votes
6 answers

How do I set a ViewModel on a window in XAML using DataContext property?

The question pretty much says it all. I have a window, and have tried to set the DataContext using the full namespace to the ViewModel, but I seem to be doing something wrong.
Nicholas
  • 3,286
  • 5
  • 27
  • 35
112
votes
3 answers

Opposite of String.Split with separators (.net)

Is there a way to do the opposite of String.Split in .Net? That is, to combine all the elements of an array with a given separator. Taking ["a", "b", "c"] and giving "a b c" (with a separator of " "). UPDATE: I found the answer myself. It is the…
robintw
  • 27,571
  • 51
  • 138
  • 205
112
votes
7 answers

How is null + true a string?

Since true is not a string type, how is null + true a string ? string s = true; //Cannot implicitly convert type 'bool' to 'string' bool b = null + true; //Cannot implicitly convert type 'string' to 'bool' What is the reason behind this?
Javed Akram
  • 15,024
  • 26
  • 81
  • 118
112
votes
5 answers

Enter "&" symbol into a text Label in Windows Forms?

How would one enter special characters into a Label in C# (Windows Forms)? If you try to write a "&" into a label you'll get a sort of underscore instead.. So what's the C# equivalent of "&"? ("\&" obviously doesn't work).
Spectraljump
  • 4,189
  • 10
  • 40
  • 55
112
votes
16 answers

Best way to hide a window from the Alt-Tab program switcher?

I've been a .NET developer for several years now and this is still one of those things I don't know how to do properly. It's easy to hide a window from the taskbar via a property in both Windows Forms and WPF, but as far as I can tell, this doesn't…
devios1
  • 36,899
  • 45
  • 162
  • 260
112
votes
15 answers

Is there a way of making strings file-path safe in c#?

My program will take arbitrary strings from the internet and use them for file names. Is there a simple way to remove the bad characters from these strings or do I need to write a custom function for this?
Martin Doms
  • 8,598
  • 11
  • 43
  • 60
112
votes
5 answers

IEnumerable vs IReadonlyCollection vs ReadonlyCollection for exposing a list member

I have spent quite a few hours pondering the subject of exposing list members. In a similar question to mine, Jon Skeet gave an excellent answer. Please feel free to have a look. ReadOnlyCollection or IEnumerable for exposing member collections? I…
Marcel De Villiers
  • 1,682
  • 4
  • 15
  • 17
112
votes
11 answers

DateTime to javascript date

From another answer on Stackoverflow is a conversion from Javascript date to .net DateTime: long msSinceEpoch = 1260402952906; // Value from Date.getTime() in JavaScript return new DateTime(1970, 1, 1) + new TimeSpan(msSinceEpoch * 10000); But how…
AJ.
  • 10,732
  • 13
  • 41
  • 50
112
votes
4 answers

Why use strong named assemblies?

What are the advantages of using strong named assemblies? What are the things that can't be done with a normal assembly?
developer
  • 3,811
  • 8
  • 31
  • 34
112
votes
23 answers

force browsers to get latest js and css files in asp.net application

Some browsers cache js and css files, failing to refresh them unless you force them to. What's the easiest way. I just implemented this solution that seems to work. Declare a version variable on your page public string version { get; set; } Get…
kiev
  • 2,040
  • 9
  • 32
  • 54
112
votes
6 answers

ASP.NET MVC: Custom Validation by DataAnnotation

I have a Model with 4 properties which are of type string. I know you can validate the length of a single property by using the StringLength annotation. However I want to validate the length of the 4 properties combined. What is the MVC way to do…
Danny van der Kraan
  • 5,344
  • 6
  • 31
  • 41
112
votes
20 answers

What's so wrong about using GC.Collect()?

Although I do understand the serious implications of playing with this function (or at least that's what I think), I fail to see why it's becoming one of these things that respectable programmers wouldn't ever use, even those who don't even know…
Trap
  • 12,050
  • 15
  • 55
  • 67
112
votes
7 answers

MemoryStream - Cannot access a closed Stream

Hi why using (var sw = new StreamWriter(ms)) returns Cannot access a closed Stream exception. Memory Stream is on top of this code. using (var ms = new MemoryStream()) { using (var sw = new StreamWriter(ms)) { …
Arbejdsglæde
  • 13,670
  • 26
  • 78
  • 144
112
votes
10 answers

When using a Settings.settings file in .NET, where is the config actually stored?

When using a Settings.settings file in .NET, where is the config actually stored? I want to delete the saved settings to go back to the default state, but can't find where it's stored... any ideas?
Adam Haile
  • 30,705
  • 58
  • 191
  • 286
112
votes
0 answers

Looking for C# HTML parser

Possible Duplicate: What is the best way to parse html in C#? I would like to extract the structure of the HTML document - so the tags are more important than the content. Ideally, it would be able to cope reasonably with badly-formed HTML to…
benefactual
  • 7,079
  • 5
  • 23
  • 16