Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 870 Bytes

Readme.md

File metadata and controls

40 lines (27 loc) · 870 Bytes

BeforeFieldInit.Fody

Fody addin.

Forces IL beforefieldinit attribute on types decorated with custom BeforeFieldInit attribute.

Usage

  1. Define custom BeforeFieldInit attribute:

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
    public class BeforeFieldInitAttribute : Attribute
    {
    }
  2. Add new attribute to your class:

    [BeforeFieldInit]
    public class MyClass
    {
        static MyClass()
        {
            // Initialization code goes here...
        }
    }

Nuget package

Coming soon...

Links

Introduction to Fody

C# and beforefieldinit