DualBrain.ImplicitInterfaceGenerator 1.0.0-alpha4

This is a prerelease version of DualBrain.ImplicitInterfaceGenerator.
dotnet add package DualBrain.ImplicitInterfaceGenerator --version 1.0.0-alpha4                
NuGet\Install-Package DualBrain.ImplicitInterfaceGenerator -Version 1.0.0-alpha4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DualBrain.ImplicitInterfaceGenerator" Version="1.0.0-alpha4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DualBrain.ImplicitInterfaceGenerator --version 1.0.0-alpha4                
#r "nuget: DualBrain.ImplicitInterfaceGenerator, 1.0.0-alpha4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DualBrain.ImplicitInterfaceGenerator as a Cake Addin
#addin nuget:?package=DualBrain.ImplicitInterfaceGenerator&version=1.0.0-alpha4&prerelease

// Install DualBrain.ImplicitInterfaceGenerator as a Cake Tool
#tool nuget:?package=DualBrain.ImplicitInterfaceGenerator&version=1.0.0-alpha4&prerelease                

Introduction

VB currently provides what is called explicit interface implementations; meaning when you implement an interface you must explicitly specify which methods, properties, etc. are going to handle the interface definition. Implicit interface implementations will attempt to infer the wiring between the interface and the class based on a set of predefined rules. This package will do this by creating a backing partial class that handles this wiring automatically for any methods, properties, etc. that can be implicitly aligned.

Requirements

  • Visual Studio 2019 v16.10.0+
  • VB

Getting Started

Once you have this in your project, you can enjoy explicit (what you have now) and implicit (what this provides) interface implementations!

Given the following interface:

Public Interface IPerson
  Property Name As String
End Interface

You could create an employee class:

Public Class Employee
  Implements IPerson

  Public Property Name As String

End Class

Which results in Visual Studio seeing this as completely legal code because the generator automatically creates:

Public Partial Class Employee

  Private Property IPerson_Name As String Implements IPerson.Name
    Get
      Return Name
    End Get
    Set(value As String)
      Name = value
    End Set
  End Property

End Class

The implicit implementation follows these rules:

  • If the interface is explicity defined, skip.
  • A method will map to a similarly named method with matching param signature.
  • A property will first attempt to map to a similarly named property with matching param signature.
  • If a property can't be determined, will attempt to map to a similarly named field; but only if it doesn't have params.

If unable to determine a map, that mapping will not be generated; which results in Visual Studio notifying the user that the interface has not been defined.

Events

Events are not handled as I haven't figured out a way to not cause double raising of events by "wrapping" an event. So, for the time being, Events must be interfaced explicitly.

More

  • You can find the project here; please leave feedback, questions, etc. via the github project.
  • Feel free to reach out to me directly via twitter.
  • Even better, join the VB conversation over on gitter.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-alpha4 216 7/7/2021
1.0.0-alpha2 200 6/24/2021