Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / May 2006

Tip: Looking for answers? Try searching our database.

Attribute called by compiler during compilation to modify compiler output?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stuart Carnie - 04 May 2006 20:48 GMT
I suspect it's unlikely, but you'll never know until you ask, but are there any attributes that would allow us to contribute to
the compiled output?

e.g.

// this class exists in a separate, compiled assembly for the compiler to load during compilation
class MyMethodCompiler : Attribute
{
  // This is called during compilation
  public override void GenerateMethod(MethodBuilder method)
  {
     // modify the IL that was generated from the compiler
  }
}

// some class in a user assembly
class MyClass
{

  [MyMethodCompiler]
  public void SomeMethod(...)
  {
    // User code in method
    ...
    ...
    ...
  }
}
cody - 05 May 2006 12:31 GMT
There is no such thing. use #if..#endif for conditional compiling or use
CSharpCodeProvider or CodeDom for generating your own code.

>I suspect it's unlikely, but you'll never know until you ask, but are there
>any attributes that would allow us to contribute to the compiled output?
[quoted text clipped - 25 lines]
>   }
> }
Nicole Calinoiu - 05 May 2006 13:20 GMT
If you're using C#, you might want to take a look at XC#
(http://www.resolvecorp.com).  It's a post-compiler that allows, amongst
other things, use of custom attributes to specify code generation during
compile-time processing.

>I suspect it's unlikely, but you'll never know until you ask, but are there
>any attributes that would allow us to contribute to the compiled output?
[quoted text clipped - 25 lines]
>   }
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.