Visual-Basic-Record-Generator
2.2.0
dotnet add package Visual-Basic-Record-Generator --version 2.2.0
NuGet\Install-Package Visual-Basic-Record-Generator -Version 2.2.0
<PackageReference Include="Visual-Basic-Record-Generator" Version="2.2.0" />
paket add Visual-Basic-Record-Generator --version 2.2.0
#r "nuget: Visual-Basic-Record-Generator, 2.2.0"
// Install Visual-Basic-Record-Generator as a Cake Addin #addin nuget:?package=Visual-Basic-Record-Generator&version=2.2.0 // Install Visual-Basic-Record-Generator as a Cake Tool #tool nuget:?package=Visual-Basic-Record-Generator&version=2.2.0
Source generators is a new feature added to VB.NET since VS.NET version 16.9. It allows you to write code to generate code that is added to your source code in compilation time. You can combine this feature with the Roslyn compiler powerful tools like SyntaxFacyoty, SyntaxTree and SemanticModel to parse, compile and analyze VB syntax and generate any additional code based on that. As an application of these concept, I made a syntax for VB Records, which consists of a Class/Structure declaration followed by a parameter list, followed by an optional Inherits statement. You can also add Imports statements at top of the file. These 4 parts are all VB valid syntax parts, but I grouped them in a new way to form the record syntax. See documentation for more information about the record syntax.
See the readme for more info about how to use the Record Generator and the record syntax.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.Analyzers (>= 3.3.2)
- Microsoft.CodeAnalysis.VisualBasic (>= 3.9.0-2.final)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# Ver 2.2:
Records now genrate the GetHashCode method, so that key properties are used in generating the hash, which is necessary when using rcords as keys in dictionaries.
# Ver 2.0:
- Allow to declare a namespace for the records.
- Allow record to implement Interfaces.
- Allow property-less records.
- Allow `As new` expression in property definition.
- Records now are aware of some default imported namespaces, like Sytem, System.Collections.Generic, and Microsoft.VisualBasic, so, you don't need to import them.
# Ver 1.2:
- Using nullable params for ValueTypes, and using Optional(T) params with nullable types and ref types.
# Ver 1.1:
- Supports using Record key word instead of <Record> Class.
- Supprts using Ky, ReadOnly (Or Immutable) and ReadOnly Key (Or Immutable Key) as keywords instead of Attrs.
- Supports using any ,net or user-defined attrs with the class it's properties.
- Supports using ?, (), and type chars after the property name.
- Enhanced ToString method to show nested records, and list elements.
# Ver1.0:
- Supports writing methods as lampda expressions.
- Supports Inheritance.
- Supports type inference for properties with default Values.