I would suspect the code below to output:
(I am a SmartForm object and using the method in SmartForm).xml
instead, however, it outputs:
(I am a SmartForm object and using the method in Item).xml
Why is that? How can I force C# to take the value from the overriding property? That is why I am overriding the property.
using System;
namespace TestInhersdk234
{
public class Program
{
static void Main(string[] args)
{
SmartForm smartForm = new SmartForm();
Console.ReadLine();
}
}
public class SmartForm : Item
{
public SmartForm()
{
Console.WriteLine(FullXmlDataStorePathAndFileName);
}
public new string GetItemTypeIdCode
{
get
{
return String.Format("(I am a {0} object and using the method in SmartForm)", this.GetType().Name);
}
}
}
public class Item
{
public string FullXmlDataStorePathAndFileName
{
get
{
return GetItemTypeIdCode + ".xml";
}
}
public string GetItemTypeIdCode
{
get
{
return String.Format("(I am a {0} object and using the method in Item)", this.GetType().Name);
}
}
}
}