Skip to content

fixed links and some typos #1259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 17, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ Visual Studio also allows us to step line by line through a program and monitor

1. Choose **Debug**, **Step Into**, or press the F11 key. Visual Studio hightlights the statement that includes the `name` variable assignment. The **Autos** window shows that `name` is `null`, and the console window displays the string "What is your name?".

1. Respond to the prompt by entering a string in the console window and pressing Enter. The console will be unresponsive, and the string you enter won't be displayed in the console window, but the [Console.ReadLine](xref:System.Console.ReadLine()) method will nevertheless capture your input.
1. Respond to the prompt by entering a string in the console window and pressing Enter. The console will be unresponsive, and the string you enter won't be displayed in the console window, but the [Console.ReadLine](xref:System.Console.ReadLine) method will nevertheless capture your input.

1. Choose **Debug**, **Step Into**, or press the F11 key. Visual Studio highlights the statement that includes the `date` variable assignment. The **Autos** window shows the [DateTime.Now](xref:System.DateTime.Now) property value and the value returned by the call to the [Console.ReadLine](xref:System.Console.ReadLine()) method. The console window also displays the string entered when the console prompted for input.
1. Choose **Debug**, **Step Into**, or press the F11 key. Visual Studio highlights the statement that includes the `date` variable assignment. The **Autos** window shows the [DateTime.Now](xref:System.DateTime.Now) property value and the value returned by the call to the [Console.ReadLine](xref:System.Console.ReadLine) method. The console window also displays the string entered when the console prompted for input.

1. Choose **Debug**, **Step Into**, or press the F11 key. The **Autos** window now shows the value of the `date` variable after the assignment from the [DateTime.Now](xref:System.DateTime.Now) property. The console window is unchanged.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@ ms.assetid: a19545d3-24af-4a32-9778-cfb5ae938287

# Publishing your Hello World application with Visual Studio 2017

In [Building a C# Hello World application with .NET Core in VIsual Studio 2017 RC](with-visual-studio-2017.md), you built your Hello World console application, and in [Debugging your C# Hello World application with Visual Studio 2017 RC](debugging-with-visual-studio-2017.md), you tested it using the Visual Studio debugger. Now that you're sure that it works as expected, you an publish it so that other users can run it. Publishing creates the set of files that are needed to run your application; you can deploy them by copying them to a target machine.
In [Building a C# Hello World application with .NET Core in Visual Studio 2017 RC](with-visual-studio-2017.md), you built your Hello World console application, and in [Debugging your C# Hello World application with Visual Studio 2017 RC](debugging-with-visual-studio-2017.md), you tested it using the Visual Studio debugger. Now that you're sure that it works as expected, you an publish it so that other users can run it. Publishing creates the set of files that are needed to run your application; you can deploy them by copying them to a target machine.

Publishing .NET Core console applications from Visual Studio has not yet been implemented in the RC release. It will be implemented in the final release of Visual Studio 2017.

You can publish your application using the [dotnet.exe](../../core/tools/dotnet.md) command line utility. To do this:
You can publish your application using the [dotnet.exe](../../core/tools/dotnet.md) command-line utility. To do this:

1. Open a console window. For example, in the **Ask me anything** text box in the Windows taskbar, enter `Command Prompt`, and then choose the **Command Prompt** desktop app to open the console window.

1. Navigate to your library's project directory. Typically, unless you've reconfigured the file location, it is in the `Documents\Visual Studio 2017\Projects\HelloWorld\HelloWorld` directory. The directory contains your source code and a project file, `HelloWorld.csproj`.

<!-- Steve, can you check this on your system? I'm sure I didn't do any renaming, but that's the directory I have on minem and I'd expect it to be HelloWorld instead of Hello. -->

1. To build a debug build of your application, issue the command `dotnet.exe publish -c debug`. To publish a release build, issue the command `dotnet.exe publish -c release`. It's generally a good idea to create a debug build of your application for additional testing, and to create the release version when testing has ended.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing this comment but is there any action item left here? @stevehoag @rpetrusha


[!TIP] If the directory that contains `dotnet.exe` is not in your path, you can find its location by entering `where dotnet.exe` in the console window.
> [!TIP]
> If the directory that contains `dotnet.exe` is not in your path, you can find its location by entering `where dotnet.exe` in the console window.

For debug versions, the final files are found in the `.\bin\debug\netcoreapp1.0\publish` directory. For release versions, they're found in the `.\bin\release\netcoreapp1.0\publish` directory. You can deploy them to target systems by copying the files generated by the publishing process into a single directory or folder. You do not have to include the `HelloWorld.pdb` file, which contains symbols used for debugging.

Expand Down
4 changes: 2 additions & 2 deletions docs/csharp/misc/cs0415.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ translation.priority.mt:
# Compiler Error CS0415
The 'IndexerName' attribute is valid only on an indexer that is not an explicit interface member declaration

This error occurs if you use an IndexerName attribute on an indexer that was an explicit implementation of an interface. This error may be avoided by removing the interface name from the declaration of the indexer, if possible. For more information, see the [IndexerNameAttribute Class](xref:System​.Runtime.CompilerServices.IndexerNameAttribute).
This error occurs if you use an IndexerName attribute on an indexer that was an explicit implementation of an interface. This error may be avoided by removing the interface name from the declaration of the indexer, if possible. For more information, see the [IndexerNameAttribute Class](xref:System​.Runtime.CompilerServices.IndexerNameAttribute).

The following sample generates CS0415:

```
```cs
// CS0415.cs
using System;
using System.Runtime.CompilerServices;
Expand Down
8 changes: 4 additions & 4 deletions docs/csharp/misc/cs0625.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ translation.priority.mt:
# Compiler Error CS0625
'field': instance field types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute

When a struct is marked with an explicit **StructLayout** attribute, all fields in the struct must have the [FieldOffset](xref:System​.Runtime​.InteropServices.FieldOffsetAttribute) attribute. For more information, see [StructLayoutAttribute Class](xref:System​.Runtime​.InteropServices.StructLayoutAttribute).
When a struct is marked with an explicit **StructLayout** attribute, all fields in the struct must have the [FieldOffset](xref:System​.Runtime​.InteropServices.FieldOffsetAttribute) attribute. For more information, see [StructLayoutAttribute Class](xref:System​.Runtime​.InteropServices.StructLayoutAttribute).

The following sample generates CS0625:

The following sample generates CS0625:

```
```cs
// CS0625.cs
// compile with: /target:library
using System;
Expand Down
44 changes: 27 additions & 17 deletions docs/csharp/programming-guide/concepts/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For many applications, you want to create and manage groups of related objects.

- [Using a Simple Collection](#BKMK_SimpleCollection)

- [Kinds of Collections](http://msdn.microsoft.com/library/e76533a9-5033-4a0b-b003-9c2be60d185b)
- [Kinds of Collections](#BKMK_KindsOfCollections)

- [System.Collections.Generic Classes](#BKMK_Generic)

Expand All @@ -58,7 +58,8 @@ For many applications, you want to create and manage groups of related objects.

- [Iterators](#BKMK_Iterators)

## <a name="BKMK_SimpleCollection"></a> Using a Simple Collection
<a name="BKMK_SimpleCollection"></a>
## Using a Simple Collection
The examples in this section use the generic <xref:System.Collections.Generic.List%601> class, which enables you to work with a strongly typed list of objects.

The following example creates a list of strings and then iterates through the strings by using a or [foreach](../../../csharp/language-reference/keywords/foreach-in.md) statement.
Expand Down Expand Up @@ -186,8 +187,9 @@ public class Galaxy
public int MegaLightYears { get; set; }
}
```

## <a name="BKMK_KindsOfCollections"></a> Kinds of Collections

<a name="BKMK_KindsOfCollections"></a>
## Kinds of Collections
Many common collections are provided by the .NET Framework. For a complete list, see [collections namespace](System.Collections%20namespaces.xml). Each type of collection is designed for a specific purpose.

Some of the common collection classes are described in this section:
Expand All @@ -198,7 +200,8 @@ public class Galaxy

- `System.Collections` classes

### <a name="BKMK_Generic"></a> System.Collections.Generic Classes
<a name="BKMK_Generic"></a>
### System.Collections.Generic Classes
You can create a generic collection by using one of the classes in the <xref:System.Collections.Generic> namespace. A generic collection is useful when every item in the collection has the same data type. A generic collection enforces strong typing by allowing only the desired data type to be added.

The following table lists some of the frequently used classes of the <xref:System.Collections.Generic?displayProperty=fullName> namespace:
Expand All @@ -213,14 +216,16 @@ public class Galaxy

For additional information, see [Commonly Used Collection Types](http://msdn.microsoft.com/library/f5d4c6a4-0d7b-4944-a9fb-3b12d9ebfd55), [Selecting a Collection Class](http://msdn.microsoft.com/library/ba049f9a-ce87-4cc4-b319-3f75c8ddac8a), and <xref:System.Collections.Generic?displayProperty=fullName>.

### <a name="BKMK_Concurrent"></a> System.Collections.Concurrent Classes
<a name="BKMK_Concurrent"></a>
### System.Collections.Concurrent Classes
In the .NET Framework 4 or newer, the collections in the <xref:System.Collections.Concurrent> namespace provide efficient thread-safe operations for accessing collection items from multiple threads.

The classes in the <xref:System.Collections.Concurrent> namespace should be used instead of the corresponding types in the <xref:System.Collections.Generic?displayProperty=fullName> and <xref:System.Collections?displayProperty=fullName> namespaces whenever multiple threads are accessing the collection concurrently. For more information, see [Thread-Safe Collections](http://msdn.microsoft.com/library/2e7ca21f-786c-4367-96be-0cf3f3dcc6bd) and <xref:System.Collections.Concurrent>.

Some classes included in the <xref:System.Collections.Concurrent> namespace are <xref:System.Collections.Concurrent.BlockingCollection%601>, <xref:System.Collections.Concurrent.ConcurrentDictionary%602>, <xref:System.Collections.Concurrent.ConcurrentQueue%601>, and <xref:System.Collections.Concurrent.ConcurrentStack%601>.

### <a name="BKMK_Collections"></a> System.Collections Classes
<a name="BKMK_Collections"></a>
### System.Collections Classes
The classes in the <xref:System.Collections?displayProperty=fullName> namespace do not store elements as specifically typed objects, but as objects of type `Object`.

Whenever possible, you should use the generic collections in the <xref:System.Collections.Generic?displayProperty=fullName> namespace or the <xref:System.Collections.Concurrent> namespace instead of the legacy types in the `System.Collections` namespace.
Expand All @@ -235,8 +240,9 @@ public class Galaxy
|<xref:System.Collections.Stack>|Represents a last in, first out (LIFO) collection of objects.|

The <xref:System.Collections.Specialized> namespace provides specialized and strongly typed collection classes, such as string-only collections and linked-list and hybrid dictionaries.

## <a name="BKMK_KeyValuePairs"></a> Implementing a Collection of Key/Value Pairs

<a name="BKMK_KeyValuePairs"></a>
## Implementing a Collection of Key/Value Pairs
The <xref:System.Collections.Generic.Dictionary%602> generic collection enables you to access to elements in a collection by using the key of each element. Each addition to the dictionary consists of a value and its associated key. Retrieving a value by using its key is fast because the `Dictionary` class is implemented as a hash table.

The following example creates a `Dictionary` collection and iterates through the dictionary by using a `foreach` statement.
Expand Down Expand Up @@ -340,8 +346,9 @@ private static void FindInDictionary2(string symbol)
Console.WriteLine("found: " + theElement.Name);
}
```

## <a name="BKMK_LINQ"></a> Using LINQ to Access a Collection

<a name="BKMK_LINQ"></a>
## Using LINQ to Access a Collection
LINQ (Language-Integrated Query) can be used to access collections. LINQ queries provide filtering, ordering, and grouping capabilities. For more information, see [Getting Started with LINQ in C#](../../../csharp/programming-guide/concepts/linq/getting-started-with-linq.md).

The following example runs a LINQ query against a generic `List`. The LINQ query returns a different collection that contains the results.
Expand Down Expand Up @@ -386,8 +393,9 @@ public class Element
public int AtomicNumber { get; set; }
}
```

## <a name="BKMK_Sorting"></a> Sorting a Collection

<a name="BKMK_Sorting"></a>
## Sorting a Collection
The following example illustrates a procedure for sorting a collection. The example sorts instances of the `Car` class that are stored in a <xref:System.Collections.Generic.List%601>. The `Car` class implements the <xref:System.IComparable%601> interface, which requires that the <xref:System.IComparable%601.CompareTo%2A> method be implemented.

Each call to the <xref:System.IComparable%601.CompareTo%2A> method makes a single comparison that is used for sorting. User-written code in the `CompareTo` method returns a value for each comparison of the current object with another object. The value returned is less than zero if the current object is less than the other object, greater than zero if the current object is greater than the other object, and zero if they are equal. This enables you to define in code the criteria for greater than, less than, and equal.
Expand Down Expand Up @@ -464,10 +472,11 @@ public class Car : IComparable<Car>
}
```

## <a name="BKMK_CustomCollection"></a> Defining a Custom Collection
<a name="BKMK_CustomCollection"></a>
## Defining a Custom Collection
You can define a collection by implementing the <xref:System.Collections.Generic.IEnumerable%601> or <xref:System.Collections.IEnumerable> interface. For additional information, see [How to: Access a Collection Class with foreach](../../../csharp/programming-guide/classes-and-structs/how-to-access-a-collection-class-with-foreach.md).

Although you can define a custom collection, it is usually better to instead use the collections that are included in the .NET Framework, which are described in [Kinds of Collections](http://msdn.microsoft.com/library/e76533a9-5033-4a0b-b003-9c2be60d185b) earlier in this topic.
Although you can define a custom collection, it is usually better to instead use the collections that are included in the .NET Framework, which are described in [Kinds of Collections](#BKMK_KindsOfCollections) earlier in this topic.

The following example defines a custom collection class named `AllColors`. This class implements the <xref:System.Collections.IEnumerable> interface, which requires that the <xref:System.Collections.IEnumerable.GetEnumerator%2A> method be implemented.

Expand Down Expand Up @@ -543,8 +552,9 @@ public class Color
public string Name { get; set; }
}
```

## <a name="BKMK_Iterators"></a> Iterators

<a name="BKMK_Iterators"></a>
## Iterators
An *iterator* is used to perform a custom iteration over a collection. An iterator can be a method or a `get` accessor. An iterator uses a [yield return](../../../csharp/language-reference/keywords/yield.md) statement to return each element of the collection one at a time.

You call an iterator by using a [foreach](../../../csharp/language-reference/keywords/foreach-in.md) statement. Each iteration of the `foreach` loop calls the iterator. When a `yield return` statement is reached in the iterator, an expression is returned, and the current location in code is retained. Execution is restarted from that location the next time that the iterator is called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ A statement attempts to access a programming element which has been marked with
- Ensure that the source-code reference is spelling the element name correctly.

## See Also
[Attributes](../../../../visual-basic/programming-guide/concepts/attributes/index.md)
[Attributes](../../../visual-basic/programming-guide/concepts/attributes/index.md)