c# - conditional EditorBrowsable by web.config AppSettings -


i have project a used reference in project b.

project a has class method should either visible or not depending on condition specified in project b. method visible if in web.config appsettings of project b there key "displaymethod" value "true".

this more of version control. don't want create separate dll new version of project a. i'd single dll able support both old , new version. way developer of project b can switch version in web.config, rebuild project , go.

restrictions

  • i don't have control on project b. can ask developer of project b simple modification web.config modification.
  • i have no idea projects using project a. project open source project , can used anybody, potentially in thousands of projects.

by "method visible" mean same functionality following code do:

[editorbrowsable(editorbrowsablestate.never)] public string somemethod(string s) {     return "hello " + s; } 

research far:

i've seen this question. accepted answer not work me since conditional constant there can set in project properties of same project method is.

conditional namespace well, there face same issues.

values attributes must known compiler @ compile time. want achive impossible. im not expert maybe mono cecil capable of that. though im not sure worth it.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -