Note that there are some explanatory texts on larger screens.

plurals
  1. POAttributes within Method Body
    primarykey
    data
    text
    <p>I know that <code>attributes</code> <em>are not supported inside the method body</em> but i wanted to know maybe someone has work around this. What i am interested in is a technique that allows you to enter <code>custom Attribute</code> inside the method body and onto an two things.</p> <ol> <li>Class Intensiation (Creating Objects <code>Foo foo = new Foo()</code>)</li> <li>When that object calls specific function (<code>foo.bar()</code>)</li> </ol> <p>later on I plan to use the <code>metadata</code> of the entered <code>attributes</code> using <code>reflection</code>. I came along a group of people that actually calims that they have <code>extented c#</code> to do so but because of no downloadable I am unable to verify it.</p> <p>Here is the link to their research paper <a href="http://www.jot.fm/issues/issue_2005_12/article2.pdf" rel="nofollow">Freely Annotating c#</a> Please advise me the solution </p> <p><strong>UPDATE</strong></p> <p>further with reflection I already know the name of class Foo and its method bar. what the purpose of this is to know that foo called bar() in some method.</p> <p>for Example</p> <pre><code> static void Main() { [p1inst] ConcretePrototype1 p1 = new ConcretePrototype1("I"); [p1call] ConcretePrototype1 c1 = (ConcretePrototype1)p1.Clone(); Console.WriteLine("Cloned: {0}", c1.Id); // Wait for user Console.Read(); } </code></pre> <p>above is example that illustrate the outcome. At present it can not be done because compiler gives error. but the authors of above mentioned research paper have claimed that they have done this to allow attributes inside the method body</p> <p><strong>The whole point is to identify that in some method an object of type <code>FOO</code> exists and that object has called <code>bar()</code> or not</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload