c# - Use Lambda in Attribute constructor to get method's parameters -


I'm also not sure whether this is possible, but I have tried to eliminate all my thoughts, I thought I would send it to the community and see what you thought. And, if this is not possible, then maybe you have some ideas.

I am trying to create an attribute class that I can add in a method that I get every parameter of the lambda expression method

  public ExampleAttribute: attribute { Public object value {get; Set; } Public ExampleAttribute (- here to work some lambda -, object value) {value = value; }}  

I want to be able to do something like this:

  [Example (x => x.Id, 4)] [Example (X => x.filter, "string value")) Public performance index (int id, string filter) {return view (); }  

I think that I can dream completely with this idea. I'm basically trying to write a model to allow for the self-documentation of the REST API documentation. In a recent project on the job, we wrote a dozen or more services with 5 to 15 methods from each, I think it is easy to write something to do, a document page for each one with hand code. I finally plan to release it as an open source project, once I place it in a place I think it is released. ">

I do not believe this is possible, but I do not think you need it anyway. Instead, you can put this feature directly on the parameters like:

  Public Performance Index ([Document ("Identifier ...") IDA, [Documentation ("Filter")] String Filters {Return ...;}  

Can be used to obtain properties.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -