Assume this type:
public class Car { }
And I create an instance of that:
Car myCar = new Car();
Target target = new Target();
target.Model = myCar;
And this is another Type:
public class Target {
public object Model { get; set; }
string GetName(){
//Use Model and return myCar in this Example
}
}
As I showed in code the GetName
method must use an object type (Model
) and returned the name of instance that is myCar in this example? what is your suggestion is there any way to do this?
Update How about this:
public class Car {
public string Title { get; set; }
}
And I pass to target: target.Model = Car.Title
And GetName()
method returned Title
?