2
Reply

what are the differences between property and local variable in C#???

Amit Soni

Amit Soni

17y
5.8k
0
Reply

    Main differences between property and local variable ( Though I believe comparing property and member variable is more approprate.)

    Local variable is declared as a single statement whereas property is a series of statmenets.

    Local variable is declared in procedure and scope remains within procedure whereas Property is associated with a class or module.

    Local variables has write and read methods whereas property has get and set methods.

    Local Variable is stored at a specific memory location and it can be accessed with memory operations. Property value may or may not be accessed.

    We can define a property as ReadOnly by using the set method, whereas in case of variable that is not posible