Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Field vs Property

Tags:

json

On this page it mentions JSON fields and properties

specify a particular field or property to examine

What is the difference between a JSON field and property?

like image 971
Zombo Avatar asked Jun 25 '13 00:06

Zombo


People also ask

What is the difference between field and property?

Properties expose fields. Fields should (almost always) be kept private to a class and accessed via get and set properties. Properties provide a level of abstraction allowing you to change the fields while not affecting the external way they are accessed by the things that use your class.

Should I use fields or properties?

Fields are normal variable members of a class. Generally, you should declare your fields as private, then use Properties to get and set their values. By this way you won't affect their values them directly.

What are fields and properties in C#?

Properties are named members of classes, structures, and interfaces. Member variables or methods in a class or structures are called Fields. Properties are an extension of fields and are accessed using the same syntax.

What is the difference between a field and a variable?

The main difference between the two is that Fields are static or instance values associated and delcared in a type, while on the other hand, local variables are declared in a method.


1 Answers

Nothing.

When talking about JSON (as opposed to C# or C++), both terms mean the same thing.

He mentions both terms to clarify for people who are only familiar with one of them.

like image 128
SLaks Avatar answered Sep 24 '22 15:09

SLaks