https://github.com/john-paul-r/getrequiresinit
Injects init-checking logic for auto-property getters.
https://github.com/john-paul-r/getrequiresinit
Last synced: 9 months ago
JSON representation
Injects init-checking logic for auto-property getters.
- Host: GitHub
- URL: https://github.com/john-paul-r/getrequiresinit
- Owner: John-Paul-R
- Created: 2022-04-23T22:53:35.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-25T21:40:03.000Z (about 4 years ago)
- Last Synced: 2025-03-22T14:28:21.990Z (about 1 year ago)
- Language: C#
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/GetRequiresInit.Fody/)
[//]: # ()
`GetRequiresInit` is a simple [Fody][fody-home] addin that adds runtime checks
to validate that properties marked with the `[GetRequiresInit]` attribute have
been initialied via their set method before their get method is called.
Calling the get method before the set method throws an
`InvalidOperationException`.
## Usage
See also [Fody usage][fody-usage].
### NuGet installation
TODO: Actually make the package
Install the [GetRequiresInit.Fody NuGet package](https://www.nuget.org/packages/GetRequiresInit.Fody/) and update the [Fody NuGet package](https://www.nuget.org/packages/Fody/):
```powershell
PM> Install-Package Fody
PM> Install-Package GetRequiresInit.Fody
```
The `Install-Package Fody` is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.
### Add to FodyWeavers.xml
Add `` to `FodyWeavers.xml`.
```xml
```
## The moving parts
See [writing an addin](/pages/addin-development.md)
## Icon
[Lego](https://thenounproject.com/term/lego/16919/) designed by [Timur Zima](https://thenounproject.com/timur.zima/) from [The Noun Project](https://thenounproject.com).
[fody-home]: https://github.com/Fody/Home
[fody-usage]: https://github.com/Fody/Home/blob/master/pages/usage.md