I have a question that I've been searching for the answer to but have not found anything as of yet. This leads me to think that I'm not asking the question correctly as I search, so I'll apologize in advance for my own confusion and lack of knowledge.
I am trying to determine if it is possible, and if so, how I can construct classes so that the Properties have additional custom methods attached to them. If feels like the hierarchy of classes, as I currently do them is very flat. Here is an extremely simplistic class and an example of what I'm attempting to execute:
Updated
namespace Test
{
public class MyClass
{
public string Value
{
get; set;
}
// HOW DO I CREATE 'AddRepetitiveCharacter(string Character, int Index)' for the 'Value' property?
}
static class Program
{
static void Main()
{
MyClass myclass = new MyClass();
Label1.Text = myclass.Value.AddRepetitiveCharacter("-", 3);
}
}
}
How can I take the Value property and add additional layers of methods to it so that I could perform additional actions on just that property? Is this possible? I've noticed that with a Struct, such as DateTime, I can do a Datetime.Now.. I'm looking to do something similar with my classes... if possible... Otherwise I can do the more traditional:
Label1.Text = AddRepetitiveCharacter(myclass.Value,"-",3);