Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have same property with two different names in .NET

Tags:

c#

.net

I have a property in a class like:

public int ProductID {get;set;}

Is it possible in .NET to make some 'alias' for this property like to give it another name like 'Product_Id'?

So later I can set this property by using:

obj.ProductID = 555;

and

obj.Product_Id = 666;
like image 485
1110 Avatar asked Nov 29 '22 15:11

1110


1 Answers

Sure:

public int Product_Id { get { return ProductID; } set { ProductID = value; } }
like image 137
Uwe Keim Avatar answered Dec 15 '22 04:12

Uwe Keim