Creating Properties
4 posts • Page 1 of 1
Creating Properties
Hi all !
Is it possible to use PostSharp as kind of Preprocessor that creates new Properties ?
E.g. I've got something like this:
I want PostSharp (using TheAttribute) to expand it to:
Can PostSharp do this ?
Hauke
Is it possible to use PostSharp as kind of Preprocessor that creates new Properties ?
E.g. I've got something like this:
- Code: Select all
class AClass
{
private int myValue;
[TheAttribute]
public int MyProperty
{
get { return myvalue; }
}
}
I want PostSharp (using TheAttribute) to expand it to:
- Code: Select all
class AClass
{
private int myValue;
public static PropertyInfo _MyProperty { get { return typeof(AClass).GetProperty("MyProperty"); } }
public int MyProperty
{
get { return myvalue; }
}
}
Can PostSharp do this ?
Hauke
- Haukinger
- Posts: 2
- Joined: Thu May 08, 2008 11:52 am
- Full Name: Hauke Lasinger
Re: Creating Properties
You can use PostSharp as a post-processor. The new property will not be visible from C# code of the same assembly. However, it will be visible to C# code of other assemblies.
However, to cannot add new properties using PostSharp Laos. You need to develop your own aspect using PostSharp Core.
.Gael
However, to cannot add new properties using PostSharp Laos. You need to develop your own aspect using PostSharp Core.
.Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: Creating Properties
Ok, that should be enough. Can you give me a hint where to start with developing my aspect ?
- Haukinger
- Posts: 2
- Joined: Thu May 08, 2008 11:52 am
- Full Name: Hauke Lasinger
Re: Creating Properties
This series of articles should help:
http://www.sitechno.com/Blog/Introducin ... onV01.aspx
Good luck.
Gael
http://www.sitechno.com/Blog/Introducin ... onV01.aspx
Good luck.
Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
4 posts • Page 1 of 1