DEV Community

Al Rodriguez
Al Rodriguez

Posted on

2

New Project: Public Interface Generator

This was originally posted at my personal site at: https://programmeral.com/posts/20240930_InterfaceSourceGenerator

New Project: Public Interface Generator

As developers we like to automate things. Anything we can automate is one less thing we waste time on later. Another thing that's getting easier to do, easier than it used to be at least, is to codify our patterns. Enforcing code patterns with code. One common pattern in C# is to create an interface that exists just to make unit test mocking easier. So why not generate the interface code instead of writing it?

Well that's the project. There's code and a NuGet package and everything. The full details are in the project README at: https://github.com/ProgrammerAL/public-interface-generator

Quick Overview: What it does

The purpose of the project is to make a C# Source Generator to create interfaces at compile time. The Source Generator will inspect all classes with the provided [GenerateInterfaceAttribute] attribute and generate an Interface of all public Methods, Properties, and Events.

NuGet Package

The NuGet package is hosted on nuget.org. You can get it from: https://www.nuget.org/packages/PublicInterfaceGenerator

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more