-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⬆️ Upgrade tests and sample app to net6.0, upgrade all nugets
- Loading branch information
1 parent
820c79c
commit 907bd55
Showing
16 changed files
with
132 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
Samples.ConsoleNet6/Example001_TopLevelStatements.Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// AssignAll enable | ||
|
||
// EXAMPLE 001 - Top level statements in the single main file, typically Program.cs. | ||
// https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements | ||
// | ||
// This should give analyzer error: | ||
// Missing member assignments in object initializer for type 'Foo'. Properties: PropUnassigned | ||
var foo = new Foo | ||
{ | ||
// Commented assignments after opening brace. OK by analyzer. | ||
// PropCommented1 = 1, | ||
|
||
// Assigned property. OK by analyzer | ||
PropAssigned = 1, | ||
|
||
// Commented assignments just before closing brace. OK by analyzer. | ||
//PropCommented2 = , | ||
// PropCommented3=, | ||
}; | ||
|
||
Console.WriteLine($"Hello, {foo}!"); | ||
|
||
// Add methods and nested types available to top level statements via a partial Program class. | ||
// ReSharper disable once UnusedType.Global | ||
public static partial class Program | ||
{ | ||
private class Foo2 | ||
{ | ||
public int PropInt { get; set; } | ||
public string PropString { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// AssignAll enable | ||
// EXAMPLE 002 - File-scoped namespaces. | ||
// https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces | ||
namespace Samples.ConsoleNet6; | ||
|
||
public static class Example002_FileScopedNamespace | ||
{ | ||
public static void Irrelevant() | ||
{ | ||
// This should give analyzer error: | ||
// Missing member assignments in object initializer for type 'Foo'. Properties: PropUnassigned | ||
var foo = new Foo | ||
{ | ||
// Commented assignments after opening brace. | ||
// PropCommented1 = 1, | ||
|
||
// Assigned property, OK by analyzer | ||
PropAssigned = 1, | ||
|
||
// Commented assignments just before closing brace | ||
//PropCommented2 = , | ||
// PropCommented3=, | ||
}; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Samples.ConsoleNet6/Example003_RegularNamespaceDeclaration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// AssignAll enable | ||
// EXAMPLE 003 - Regular namespace declarations with a body. | ||
// https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces | ||
namespace Samples.ConsoleNet6 | ||
{ | ||
public static class Example003_RegularNamespaceDeclaration | ||
{ | ||
public static void Irrelevant() | ||
{ | ||
// This should give analyzer error: | ||
// Missing member assignments in object initializer for type 'Foo'. Properties: PropUnassigned | ||
var foo = new Foo | ||
{ | ||
// Commented assignments after opening brace. | ||
// PropCommented1 = 1, | ||
|
||
// Assigned property, OK by analyzer | ||
PropAssigned = 1, | ||
|
||
// Commented assignments just before closing brace | ||
//PropCommented2 = , | ||
// PropCommented3=, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Samples.ConsoleNet6; | ||
|
||
internal class Foo | ||
{ | ||
public int PropAssigned { get; set; } | ||
public int PropCommented1 { get; set; } | ||
public int PropCommented2 { get; set; } | ||
public int PropCommented3 { get; set; } | ||
public int PropUnassigned { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Global using directives | ||
|
||
global using Samples.ConsoleNet6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include=".editorconfig" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AssignAll" Version="1.5.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |