Hi, Pedro, I wish I had gone deep enough into T4 that I could help you here; if you do not get a useful reply here in a few days, I suggest you post this on StackOverFlow.
You could explore the System.Dynamic namespace for late-binding resources ... if that is what you are trying to achieve here.
Are you aware of the CallerMemberName feature of C# 5.0, .NET 4.5, 4.6, which can eliminate the need for you to use hard-coded strings to transmit the name of a Property ? [
^]
using System.Runtime.CompilerServices;
public bool SomeFunc(int oldvalue, int newvalue, [CallerMemberName] string pname = null)
{
Console.WriteLine("Current Value: {0} New Value: {1} FromProperty: {2}", oldvalue, newvalue, pname);
return oldvalue != newvalue;
}
private int _myintprop;
public int MyIntProp
{
set { if (SomeFunc(_myintprop, value)) _myintprop = value; }
get { return _myintprop; }
}