Skip to content

NickStrupat/Ephemera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ephemera

.NET ephemerons

Attach and use properties to objects at run-time which are automatically collected after the host object is collected.

This is accomplished with weak-references, implemented in the ConditionalWeakTable class

.NET support NuGet package
>= Framework 4.0 || >= Standard 2.0 NuGet Status

Usage

var foo = new Foo();

// Attach some things to `foo`
foo.Fmrn().Set("Name", "Value");
foo.Fmrn().Set("Bar", new Bar());

// Retrieve them
var bar = foo.Fmrn().Get<Bar>("Bar");
var name = foo.Fmrn().Get<String>("Name");

// Retrieve with `TryGet`
var didGetUnsetProperty = foo.Fmrn().TryGet("Nope", out var unset);

About

Attach and use properties to objects at run-time

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages