Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/core/tools/dotnet-publish.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
---
title: dotnet publish command - .NET Core CLI
description: The dotnet publish command publishes your .NET Core project into a directory.
keywords: dotnet-publish, CLI, CLI command, .NET Core
author: blackdwarf
author: mairaw
ms.author: mairaw
ms.date: 08/12/2017
ms.date: 09/01/2017
ms.topic: article
ms.prod: .net-core
ms.technology: dotnet-cli
ms.devlang: dotnet
ms.assetid: f2ef275a-7c5e-430a-8c30-65f52af62771
---
# dotnet publish

Expand Down Expand Up @@ -89,6 +86,7 @@ Doesn't perform an implicit restore when running the command.
`-o|--output <OUTPUT_DIRECTORY>`

Specifies the path for the output directory. If not specified, it defaults to *./bin/[configuration]/[framework]/* for a framework-dependent deployment or *./bin/[configuration]/[framework]/[runtime]* for a self-contained deployment.
If a relative path is provided, the output directory generated is relative to the project file location, not to the current working directory.

`--self-contained`

Expand Down Expand Up @@ -127,6 +125,7 @@ Specifies one or several [target manifests](../deploying/runtime-store.md) to us
`-o|--output <OUTPUT_DIRECTORY>`

Specifies the path for the output directory. If not specified, it defaults to *./bin/[configuration]/[framework]/* for a framework-dependent deployment or *./bin/[configuration]/[framework]/[runtime]* for a self-contained deployment.
If a relative path is provided, the output directory generated is relative to the project file location, not to the current working directory.

`-r|--runtime <RUNTIME_IDENTIFIER>`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Class 'class' cannot have multiple base classes: 'class_1' and 'class_2'
The most common cause of this error message is attempting to use multiple inheritance. A class in C# may only inherit directly from one class. However, a class can implement any number of interfaces.

## Example
The following example shows one way in which SC1721 is generated, and then shows two possible ways to avoid the error.
The following example shows one way in which CS1721 is generated, and then shows two possible ways to avoid the error.

```csharp
// CS1721.cs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
---
title: "LINQ to XML for XPath Users (C#)"
ms.custom: ""
ms.date: "2015-07-20"
ms.prod: .net
ms.reviewer: ""
ms.suite: ""
ms.technology:
- "devlang-csharp"

ms.topic: "article"
dev_langs:
- "CSharp"
ms.assetid: 91774511-1dca-4f06-ac0b-913746f104fe
caps.latest.revision: 3
author: "BillWagner"
ms.author: "wiwagn"

---
# LINQ to XML for XPath Users (C#)
This set of topics show a number of XPath expressions and their [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] equivalents.
Expand All @@ -36,7 +31,7 @@ This set of topics show a number of XPath expressions and their [!INCLUDE[sqltec
|[How to: Find Elements in a Namespace (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace-xpath-linq-to-xml.md)|Compares the use of the XPath <xref:System.Xml.XmlNamespaceManager> class with the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] <xref:System.Xml.Linq.XName.Namespace%2A> property of the <xref:System.Xml.Linq.XName> class for working with XML namespaces.<br /><br /> The associated XPath expression is:`"./aw:*"`|
|[How to: Find Preceding Siblings (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md)|Compares the XPath `preceding-sibling` axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] child <xref:System.Xml.Linq.XNode.ElementsBeforeSelf%2A?displayProperty=fullName> axis.<br /><br /> The associated XPath expression is:`"preceding-sibling::*"`|
|[How to: Find Descendants of a Child Element (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md)|Compares how to get the descendant elements of a child element with a particular name with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].<br /><br /> The associated XPath expression is:`"./Paragraph//Text/text()"`|
|[How to: Find a Union of Two Location Paths (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md)|Compares the use of the union operator, `&#124;`, in XPath with the <xref:System.Linq.Enumerable.Concat%2A> standard query operator in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].<br /><br /> The associated XPath expression is:`"//Category&#124;//Price"`|
|[How to: Find a Union of Two Location Paths (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md)|Compares the use of the union operator, <code>&#124;</code>, in XPath with the <xref:System.Linq.Enumerable.Concat%2A> standard query operator in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].<br /><br /> The associated XPath expression is:<code>"//Category&#124;//Price"</code>|
|[How to: Find Sibling Nodes (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md)|Compares how to find all siblings of a node that have a specific name with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].<br /><br /> The associated XPath expression is:`"../Book"`|
|[How to: Find an Attribute of the Parent (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md)|Compares how to navigate to the parent element and find an associated attribute using XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].<br /><br /> The associated XPath expression is:`"../@id"`|
|[How to: Find Attributes of Siblings with a Specific Name (XPath-LINQ to XML) (C#)](../../../../csharp/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name-xpath-linq-to-xml.md)|Compares how to find specific attributes of the siblings of the context node with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].<br /><br /> The associated XPath expression is:`"``../Book/@id``"`|
Expand Down
10 changes: 5 additions & 5 deletions docs/csharp/whats-new/csharp-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ auto-properties. C# 6 improves the auto-properties capabilities so that you can
them in more scenarios. You won't need to fall back on the more verbose syntax of
declaring and manipulating the backing field by hand so often.

The new syntax addresses scenarios for read only properties, and for initializing
The new syntax addresses scenarios for read-only properties, and for initializing
the variable storage behind an auto-property.

### Read-only auto-properties
Expand Down Expand Up @@ -97,7 +97,7 @@ public class Student

public void ChangeName(string newLastName)
{
// Generates CS 0200: Property or indexer cannot be assigned to -- it is read only
// Generates CS0200: Property or indexer cannot be assigned to -- it is read only
LastName = newLastName;
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ is part of the property declaration, making it easier to equate the
storage allocation with public interface for `Student` objects.

Property Initializers can be used with read/write properties as well
as read only properties, as shown here.
as read-only properties, as shown here.

[!code-csharp[ReadWriteInitialization](../../../samples/snippets/csharp/new-in-6/newcode.cs#ReadWriteInitialization)]

Expand All @@ -140,12 +140,12 @@ as read only properties, as shown here.
The body of a lot of members that we write consist of only one statement
that can be represented as an expression. You can reduce that syntax by
writing an expression-bodied member instead. It works for methods and
read-only properties." For example, an override of `ToString()` is often
read-only properties. For example, an override of `ToString()` is often
a great candidate:

[!code-csharp[ToStringExpressionMember](../../../samples/snippets/csharp/new-in-6/newcode.cs#ToStringExpressionMember)]

You can also use expression-bodied members in read only properties as well:
You can also use expression-bodied members in read-only properties as well:

[!code-csharp[FullNameExpressionMember](../../../samples/snippets/csharp/new-in-6/newcode.cs#FullNameExpressionMember)]

Expand Down
124 changes: 124 additions & 0 deletions docs/csharp/whats-new/csharp-version-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
title: The history of C# - C# Guide
description: What did the language look like in its earliest versions, and how has it evolved since?
keywords: C#, .NET, .NET Core, What's New, C# History
author: erikdietrich
ms.author: wiwagn
ms.date: 09/20/2017
ms.topic: article
ms.prod: .net
ms.technology: devlang-csharp
ms.devlang: csharp
---

# The history of C# #

What did the language look like in its earliest incarnations? And how has it evolved in the years since?

## C# version 1.0

When you go back and look, C# version 1.0 looked a lot like Java. As [part of its stated design goals for ECMA](http://feeldotneteasy.blogspot.com/2011/01/c-design-goals.html), it sought to be a "simple, modern, general purpose object-oriented language." At the time, looking like Java meant it achieved those early design goals.

But if you look back on C# 1.0 now, you'd find yourself a little dizzy. It lacked the built-in async capabilities and some of the slick functionality around generics that we take for granted. As a matter of fact, it lacked generics altogether. And [LINQ](../linq/index.md)? Not available yet. That would take some years to come out.

C# version 1.0 looked stripped of features, compared to today. You'd find yourself writing some verbose code. But yet, you have to start somewhere. C# version 1.0 was a viable alternative to Java on the Windows platform.

## C# version 2.0

Now things start to get interesting. Let's take a look at some major features of C# 2.0, released in 2005, along with Visual Studio 2005:

- [Generics](../programming-guide/generics/index.md)
- [Partial types](../programming-guide/classes-and-structs/partial-classes-and-methods.md#partial-classes)
- [Anonymous methods](../programming-guide/statements-expressions-operators/anonymous-methods.md)
- [Nullable types](../programming-guide/nullable-types/index.md)
- [Iterators](../programming-guide/concepts/iterators.md)
- [Covariance and contravariance](../programming-guide/concepts/covariance-contravariance/index.md)

While C# may have started as a pretty generic Object-Oriented (OO) language, C# version 2.0 changed that in a hurry. Once they had their feet under them, they went after some serious developer pain points. And they went after them in a big way.

With generics, you have types and methods that can operate on an arbitrary type while still retaining type safety. So, for instance, having a <xref:System.Collections.Generic.List%601> lets you have `List<string>` or `List<int>` and perform type safe operations on those strings or integers while you iterate through them. This is better than creating `ListInt` inheritors or casting from `Object` for every operation.

C# version 2.0 brought iterators. To put it succinctly, this lets you iterate through the items in a `List` (or other Enumerable types) with a `foreach` loop. Having this as a first-class part of the language dramatically enhanced readability of the language and people's ability to reason about the code.

And yet, C# continued to play a bit of catch-up with Java. Java had already released versions that included generics and iterators. But that would soon change as the languages continued to evolve apart.

## C# version 3.0

C# version 3.0 came in late 2007, along with Visual Studio 2008, though the full boat of language features would actually come with C# version 3.5. This version marked a major change in the growth of C#. It established C# as a truly formidable programming language. Let's take a look at some major features in this version:

- [Auto implemented properties](../programming-guide/classes-and-structs/auto-implemented-properties.md)
- [Anonymous types](../programming-guide/classes-and-structs/anonymous-types.md)
- [Query expressions](../linq/query-expression-basics.md)
- [Lambda expression](https://www.daedtech.com/introduction-to-c-lambda-expressions/)
- [Expression trees](https://blogs.msdn.microsoft.com/charlie/2008/01/31/expression-tree-basics/)
- [Extension methods](https://www.codeproject.com/Tips/709310/Extension-Method-In-Csharp)

In retrospect, many of these features seem both inevitable and inseparable. They all fit together strategically. It's generally thought that C# version's killer feature was the query expression, also known as Language-Integrated Query (LINQ).

A more nuanced view examines expression tress, lambda expressions, and anonymous types as the foundation upon which LINQ is constructed. But, in either case, C# 3.0 presented a revolutionary concept. C# 3.0 had begun to lay the groundwork for turning C# into a hybrid Object Oriented / Functional language.

Specifically, you could now write SQL-style, declarative queries to perform operations on collections, among other things. Instead of writing a `for` loop to compute the average of a list of integers, you could now do that as simply as `list.Average()`. The combination of query expressions and extension methods made it look as though that list of integers had gotten a whole lot smarter.

It took time for people to really grasp and integrate the concept, but they gradually did. And now, years later, code is much more concise, simple, and functional.

## C# version 4.0

C# version 4.0 would have had a difficult time living up to the groundbreaking status of version 3.0. With version 3.0, C# had moved the language firmly out from the shadow of Java and into prominence. The language was quickly becoming elegant.

The next version did introduce some interesting new features:

- [Dynamic binding](../language-reference/keywords/dynamic.md)
- [Named/optional arguments](../programming-guide/classes-and-structs/named-and-optional-arguments.md)
- [Generic covariant and contravariant](../../standard/generics/covariance-and-contravariance.md)
- [Embedded interop types](https://stackoverflow.com/questions/20514240/whats-the-difference-setting-embed-interop-types-true-and-false-in-visual-studi)

Embedded interop types alleviated a deployment pain. Generic covariance and contravariance give you more power to use generics, but they're a bit academic and probably most appreciated by framework and library authors. Named and optional parameters let you eliminate many method overloads and provide convenience. But none of those features are exactly paradigm altering.

The major feature was the introduction of the `dynamic` keyword. The `dynamic` keyword introduced into C# version 4.0 the ability to override the compiler on compile-time typing. By using the dynamic keyword, you can create constructs similar to dynamically typed languages like JavaScript. You can create a `dynamic x = "a string"` and then add six to it, leaving it up to the runtime to sort out what should happen next.

This gives you the potential for errors but also great power within the language.

## C# version 5.0

C# version 5.0 was a very focused version of the language. Nearly all of the effort for that version went into another groundbreaking language concept. Here is the major features list:

- [Asynchronous members](../async.md)
- [Caller info attributes](https://www.codeproject.com/Tips/606379/Caller-Info-Attributes-in-Csharp)

The caller info attribute lets you easily retrieve information about the context in which you're running without resorting to a ton of boilerplate reflection code. It has many uses in diagnostics and logging tasks.

But `async` and `await` are the real stars of this release. When these features came out in 2012, C# changed the game again by baking asynchrony into the language as a first-class participant. If you've ever dealt with long running operations and the implementation of webs of callbacks, you probably loved this language feature.

## C# version 6.0

With versions 3.0 and 5.0, C# had added some impressive features in an object oriented language. With version 6.0, it would go away from doing a dominant killer feature and instead release many features that delighted users of the language. Here are some of them:

- [Static imports](../language-reference/keywords/using-static)
- [Exception filters](https://www.thomaslevesque.com/2015/06/21/exception-filters-in-c-6/)
- [Property initializers](http://geekswithblogs.net/WinAZ/archive/2015/06/30/whatrsquos-new-in-c-6.0-auto-property-initializers.aspx)
- [Expression bodied members](https://lostechies.com/jimmybogard/2015/12/17/c-6-feature-review-expression-bodied-function-members/)
- [Null propagator](https://davefancher.com/2014/08/14/c-6-0-null-propagation-operator/)
- [String interpolation](../language-reference/keywords/interpolated-strings.md)
- [nameof operator](https://stackoverflow.com/questions/31695900/what-is-the-purpose-of-nameof)
- [Dictionary initializer](../programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md)

Each of these features is interesting in its own right. But if you look at them altogether, you see an interesting pattern. In this version, C# eliminated language boilerplate to make code more terse and readable. So for fans of clean, simple code, this language version was a huge win.

They did one other thing along with this version, though it's not a traditional language feature in itself. They released [Roslyn the compiler as a service](https://github.com/dotnet/roslyn). The C# compiler is now written in C#, and you can use the compiler as part of your programming efforts.

## C# version 7.0

The most recent major version is C# version 7.0. This version has some evolutionary and cool stuff in the vein of C# 6.0, but without the compiler as a service. Here are some of the new features:

- [Out variables](http://www.c-sharpcorner.com/article/out-variables-in-c-sharp-7-0/)
- [Tuples and deconstruction](https://www.thomaslevesque.com/2016/08/23/tuple-deconstruction-in-c-7/)
- [Pattern matching](./csharp-7.md#pattern-matching)
- [Local functions](http://www.infoworld.com/article/3182416/application-development/c-7-in-depth-exploring-local-functions.html)
- [Expanded expression bodied members](./csharp-7.md#more-expression-bodied-members)
- [Ref locals and returns](./csharp-7.md#ref-locals-and-returns)

All of these features offer cool new capabilities for developers and the opportunity to write even cleaner code than ever. A highlight is condensing the declaration of variables to use with the `out` keyword and by allowing multiple return values via tuple.

But C# is being put to ever broader use. .NET Core now targets any operating system and has its eyes firmly on the cloud and on portability. This certainly occupies the language designers' thoughts and time, in addition to coming up with new features.

_Article_ [_originally published on the NDepend blog_](https://blog.ndepend.com/c-versions-look-language-history/)_, courtesy of Erik Dietrich and Patrick Smacchia._
Loading