I have a class like this:
class Person {
public FirstName: string;
private LastName: string;
private _Age: number;
public get Age() {
return this._age;
}
public set Age(theAge: number) {
if (theAge <= 0 || theAge >= 200) {
throw new Error('The age is invalid');
}
this._age = theAge;
}
}
I want to send the object of this class to my web API, but I want it in the form
class Person {
FirstName: string;
LastName: string;
Age: number;
}
Is there any way to show the getter setter name (Age) instead of (_age) in the class objects without creating another object an map members?