I've been wondering for a time now - in C# is there a way to define a "template" for several properties within a class. Here is what I mean:
Let's assume I have the following class
class MyCLass
{
public int IntVal1 { get {...}; set{...} }
public byte IntVal2 { get {...}; set{...} }
....
public long IntValN { get {...}; set{...} }
}
I did not write any specific implementation in the get and set accessors but the idea is that all these properties have very similar implementations - the difference may be that they operate on different members of the class which have different types, but as a whole they all look alike.
My idea is to find a way to define some sort of (let's call it) "template" with some parameters probably that may be used to declare all these properties without the need to write the actual implementation of each and every one of them - maybe using attributes!?!
I guess what I need is similar to a C macro.