Giter Club home page Giter Club logo

newbe.objectvisitor's Introduction

Newbe.ObjectVisitor

All Contributors

  • build and scan
  • Codecov
  • Coverage
  • Quality Gate Status
  • Codacy Badge
  • xml document Crowdin
  • documents Crowdin

Banner

You can visit all properties about your class by this lib with high performance as you visit properties in hard coding way.

For example, here is object in your code.

var order = new OrderInfo();

And, you want to print all properties of the order.

for(var pInfo in typeof(OrderInfo).GetProperties())
{
    Console.Writeline($"{pInfo.Name}: {pInfo.GetValue(order)}");
}

By using this lib, you can handle it in this way:

// call .V what is a static extension method
// you get a visitor object for order
var visitor = order.V();

visitor.ForEach(context=>{
    var name = context.Name;
    var value = context.Value;
    Console.Writeline($"{name}: {value}");
}).Run();

// you can also make it into one line
order.V().ForEach(c=> Console.Writeline($"{c.Name}: {c.Value}")).Run();

// or using quick style
order.FormatToString();

Why do I need this?

  • It is faster. This lib is impletmented with Expression Trees that cost 1/10 time as in Reflection way.
  • It is readable. This lib can generate a lambda func to handle the code flow you create that just as your hard coding without reflection.
  • It is extendable. If you can visit all properties of a object in easy way, you can validate them as you wish, change some value if there are something sensitive, creare a mapper like automapper, and etc.

API

Please check out the latest full API documents in site below:

Packages

package version download descrption
Newbe.ObjectVisitor Newbe.ObjectVisitor.Version Newbe.ObjectVisitor.Download Core about Newbe.ObjectVisitor

Contact

QQ Group: 【Newbe.Claptrap CL4P-TP 610394020 】:https://jq.qq.com/?_wv=1027&k=Lkhbwj0o

Stargazers over time

Stargazers over time

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Newbe36524

📝 💻 📖

kotone

🎨

黑洞视界

🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

newbe.objectvisitor's People

Contributors

newbe36524 avatar allcontributors[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.