I am trying to use CallerMemberName
attribute in .NET 4.0 via BCL portability pack. It is always returning an empty string instead of the member name. What am I doing wrong?
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
MessageBox.Show(new class2().CallMe);
}
}
public class class2
{
public string CallMe
{
get
{
return HelpMe();
}
}
private string HelpMe([CallerMemberName] string param = "")
{
return param;
}
}