I have a class which i can read but not write because of the company policy. I have following structures in my project.
public class Name // can not touch this class OR modify it
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string GetNames()
{
return FirstName + " " + LastName;
}
}
public class Details
{
// some methods and properties.
public Name LoadName() // This method return type i can not change as this method is used in ObjectDataSource for GridView
{
var names = new Name();
if (txtInpput.Text == "Jermy")
{
names.FirstName = "Jermy";
names.LastName = "Thompson";
}
else
{
names.FirstName = "Neville";
names.LastName = "Vyland";
}
return
names;
}
}
No I want to add extra property in class Name
called "Email Address"
and use class Details
LoadName() method to return the type which includes the **Email Address**
as well. as i am bound to use that method i can not change the return type Name
to something else.
I can extend the class Name
and overrides
the GetNames()
method to include the newly created property but that wont help as i can not change the return type in class Details LoadName()
method.
I am not sure this is even possible BUT just wondering if there are any solutions.
I am suing
.NET 3
VS 2010