Skip to content

Latest commit

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Refer

This library aims to manage references to fields or properties nested in other structures, similar in its idea to the ref keyword. Unlike with the ref keyword the wrapped property or field can be dynamically reassigned to a different base object, so the binding is not to a place in memory, but to a path pointing inside a data structure, which is itself similar to the concept of lenses.

Example

usingRefer;usingstaticSystem.Console;publicclassBar{publicintX{get;set;}}publicclassFoo{publicBarB{get;}=newBar();}publicclassProgram{publicstaticvoidMain(){varfoo=newFoo(){B={X=5,},};varreference=foo.Bind(f =>f.B.X);WriteLine(reference);// 5floatvalue=reference;// Implicitly converts to its underlying type,// in this case int, which initializes the float valueWriteLine(value==5);// Truereference.Value=7;WriteLine(foo.B.X);// 7}}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages