Skip to content

Commit 30ecb8e

Browse files
committed
Further improvements in language and style
1 parent 498e471 commit 30ecb8e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

README-GENERICS.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# Public Preview for CLR with support for generics
1+
# Generics Public Preview for .NET nanoFramework CLR
2+
3+
## Table of Contents
4+
5+
- [Generics in C# (Overview)](#generics-in-c-overview)
6+
- [Using Preview Firmware with Generics Support](#using-preview-firmware-with-generics-support)
7+
- [Installing the Preview Visual Studio Extension](#installing-the-preview-visual-studio-extension)
8+
- [Updating Project NuGet Packages to 2.0+ Preview](#updating-project-nuget-packages-to-20-preview)
9+
- [Feedback and Known Issues](#feedback-and-known-issues)
210

311
## Generics in C# (Overview)
412

@@ -24,7 +32,7 @@ int biggerInt = Max(10, 42); // works with int
2432
string laterString = Max("apple", "zebra"); // works with string
2533
```
2634

27-
**Example – Generic Class:** You can also define generic classes. For instance, a minimal generic stack class could be defined as:
35+
**Example – Generic Class:** You can also define generic classes. For instance, a minimal generic stack class could be defined as:
2836

2937
```csharp
3038
public class Stack<T>
@@ -39,7 +47,7 @@ public class Stack<T>
3947

4048
This `Stack<T>` can be used as `Stack<int>` for an integer stack or `Stack<string>` for a string stack, etc., each providing compile-time type enforcement.
4149

42-
*Generics have been a fundamental feature in desktop .NET for years. However, due to the constraints of embedded devices, previous versions of **.NET nanoFramework** did **not support generics**. With this preview, nanoFramework is introducing support for generics, closing the gap with standard C# capabilities.* Developers can now write more flexible and reusable code on microcontrollers, similarly to how they would on the full .NET runtime. Keep in mind that this is an initial **preview** – while most generic scenarios are expected to work, there may be limitations or bugs as this feature is brand new to constrained devices.
50+
*Generics have been a fundamental feature in desktop .NET for years. However, due to the constraints of embedded devices, previous versions of **.NET nanoFramework** did **not support generics**. With this preview, nanoFramework is introducing support for generics, closing the gap with standard C# capabilities.* Developers can now write more flexible and reusable code on microcontrollers, just as they would on the full .NET runtime. Keep in mind that this is an initial **preview** – while most generic scenarios are expected to work, there may be limitations or bugs as this feature is brand new to constrained devices.
4351

4452
## Using Preview Firmware with Generics Support
4553

@@ -68,15 +76,15 @@ Developing with the generics preview requires a **preview version of the .NET na
6876

6977
These links provide the `.vsix` installer for the extension. (You can also set up the VSIX gallery feed in Visual Studio to get preview updates (instructions on [this](https://nanoframework.net/setup-visual-studio-to-access-preview-versions-feed/#:~:text=3,along%20with%20the%20following%20URL) blog post, but direct download is simplest.)
7078

71-
**2. Install the VSIX in Visual Studio:** After downloading the file, double click on it and the extension installer will open. Just follow the workflow and confirm the options. Note that all Visual Studio instances have to be closed.
79+
**2. Install the VSIX in Visual Studio:** After downloading the file, double-click on it and the extension installer will open. Just follow the workflow and confirm the options. Note that all Visual Studio instances have to be closed.
7280

7381
Once the preview extension is installed, Visual Studio will be aware of generics support for .NET nanoFramework projects. This extension update is necessary – older versions of the extension (from the official VS Marketplace) do not understand generics and would flag errors or fail to deploy projects using generics.
7482

75-
> **Warning:** Despite we've tried to make that possible using preview features in VS extension, it's not possible to support pre and post generics projects with the same extension. Therefore, you have to install the preview version for generics support or a stable one to work with the current stable versions. It is not an option to install pre and post generics extensions in VS2019 and VS2022, for example as both use the same msbuild components for the project system and builds.
83+
> **Warning:** Despite our efforts to make this possible using the VS extension preview, its not possible to support pre- and post-generics projects with the same extension. Therefore, you have to install the preview version for generics support or a stable one to work with the current stable versions. It is not an option to install pre- and post-generics extensions in VS2019 and VS2022, for example, as both use the same msbuild components for the project system and builds.
7684
7785
## Updating Project NuGet Packages to 2.0+ Preview
7886

79-
In addition to firmware and the VS extension, your project’s NuGet packages (nanoFramework class libraries) must be updated to **preview versions (2.0.x or higher)** that include generics support. Core libraries are being been revved to **2.0.0-preview** (or later) for this feature. These preview NuGets are distributed through the public NuGet.org feed.
87+
In addition to firmware and the VS extension, your project’s NuGet packages (nanoFramework class libraries) must be updated to **preview versions (2.0.x or higher)** that include generics support. Core libraries have been revved to **2.0.0-preview** (or later) for this feature. These preview NuGets are distributed through the public NuGet.org feed.
8088

8189
**Update NuGet Packages:** In your nanoFramework project, open **Manage NuGet Packages** and enable "Include prerelease" (if applicable) to see the preview versions. Update all relevant **.NET nanoFramework** packages (such as **nanoFramework.CoreLibrary**, **System.*** assemblies, etc.) to the latest 2.x preview versions available from NuGet feed. The **CoreLibrary** (mscorlib) is especially important to update, as generics support starts there.
8290

0 commit comments

Comments
 (0)