EventGenerator.Generator 0.2.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package EventGenerator.Generator --version 0.2.4                
NuGet\Install-Package EventGenerator.Generator -Version 0.2.4                
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="EventGenerator.Generator" Version="0.2.4">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EventGenerator.Generator --version 0.2.4                
#r "nuget: EventGenerator.Generator, 0.2.4"                
#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 EventGenerator.Generator as a Cake Addin
#addin nuget:?package=EventGenerator.Generator&version=0.2.4

// Install EventGenerator.Generator as a Cake Tool
#tool nuget:?package=EventGenerator.Generator&version=0.2.4                

EventGenerator

Generated events and OnEvent() methods.

Install

Install-Package EventGenerator.Generator // Generator
Install-Package EventGenerator.Core // Attributes

Usage

using EventGenerator;

#nullable enable

namespace H.Generators.IntegrationTests;

public class MyArgs : EventArgs
{
}

[Event<MyArgs>("Changed")]
public partial class MyClass
{
}

will generate:

//HintName: MyClass.Events.Changed.generated.cs
#nullable enable

namespace H.Generators.IntegrationTests
{
    public partial class MyClass
    {
        /// <summary>
        /// </summary>
        public event global::System.EventHandler<global::H.Generators.IntegrationTests.MyArgs>? Changed;

        /// <summary>
        /// A helper method to raise the Changed event.
        /// </summary>
        protected global::H.Generators.IntegrationTests.MyArgs OnChanged(global::H.Generators.IntegrationTests.MyArgs args)
        {
            Changed?.Invoke(this, args);

            return args;
        }
    }
}

XML documentation

If for some reason you need to save xml documentation for your properties, there is an option to specify xml text for both DependencyProperty and getter/setter via XmlDocumentation/PropertyXmlDocumentation attribute properties.

Notes

To use generic attributes, you need to set up LangVersion in your .csproj:

<LangVersion>preview</LangVersion>

There are also non-Generic attributes here.

Support

Priority place for bugs: https://github.com/HavenDV/EventGenerator/issues
Priority place for ideas and general questions: https://github.com/HavenDV/EventGenerator/discussions
I also have a Discord support channel:
https://discord.gg/g8u2t9dKgE

There are no supported framework assets in this 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 (3)

Showing the top 3 popular GitHub repositories that depend on EventGenerator.Generator:

Repository Stars
HavenDV/H.NotifyIcon
TrayIcon for WPF/WinUI/Uno/MAUI
HavenDV/H.Pipes
A simple, easy to use, strongly-typed, async wrapper around .NET named pipes.
HavenDV/H.Socket.IO
This is the Socket.IO client for .NET, which is based on ClientWebSocket, provide a simple way to connect to the Socket.IO server. The target framework is .NET Standard 2.0
Version Downloads Last updated
0.13.1 63 9/2/2024
0.13.0 2,373 3/30/2023
0.12.0 185 3/30/2023
0.11.0 619 3/9/2023
0.10.0 516 1/19/2023
0.9.0 444 1/4/2023
0.8.2 292 1/4/2023
0.8.1 269 1/4/2023
0.8.0 296 1/4/2023
0.6.0 295 11/22/2022
0.4.2 545 10/9/2022
0.4.1 449 7/25/2022
0.4.0 374 7/25/2022
0.3.3 376 7/25/2022
0.3.2 390 7/24/2022
0.3.1 414 7/24/2022
0.2.5 452 7/19/2022
0.2.4 431 7/19/2022
0.2.3 414 7/19/2022
0.2.2 458 7/19/2022

⭐ Last 10 features:
Initial release.
🐞 Last 10 bug fixes:
Added sealed class detection.
Fixed README example.
Fixed .props.
Fixed package name.