I just came across something strange, and I posted it here because although it is C# it is still part of learning ASP.NET.
Usually when you use setters and getters, you have proper methods to set and access private variables (I'm referring to C++ and JAVA mainly) but here in C# you seem to have setters and getters methods and then this strange syntax:
public class Product
{
private string name;
private decimal price;
private string imageUrl;
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
What on earth is that? So Name is effectively a public variable here isn't it? And how about get and set? what are they? Methods?!