Linked Questions
65 questions linked to/from Difference between Property and Field in C# 3.0+
7 votes
2 answers
29k views
C# field vs. property [duplicate]
Possible Duplicate: Difference between Property and Field in C# I thought that basic properties ({ get; set; }) where the same as public fields, with only the advantage of being able to change ...
6 votes
5 answers
2k views
C# autoproperty vs normal fields [duplicate]
is there any effective difference between Foo.Something and Bar.Something in this example? class Foo { public string Something; } class Bar { public string Something{get; set;} } class ...
3 votes
4 answers
5k views
When to use get and set in C# class declaration [duplicate]
Possible Duplicate: Difference between Property and Field in C# .NET 3.5+ What's the difference between using public string Username { get; set; } and using public string Username; I have ...
1 vote
5 answers
8k views
Difference between Properties with get; set; and without get; set; [duplicate]
I do not understand the difference between static properties: public static int intId; and get;set; properties: public int intId { get { return intId; } set { intId = value; } } ...
0 votes
5 answers
198 views
Code comparison - Which is better or unnecessary? [duplicate]
Possible Duplicate: Difference between Property and Field in C# public class Test { public bool testData1; public string testData2; } or public class Test { public bool TestData1 { ...
2 votes
1 answer
7k views
C# - Advantages for using properties v. fields [duplicate]
Possible Duplicate: What is the difference between a field and a property in C#? Difference between Property and Field in C# .NET 3.5+ Some time ago I inherited a C# web app wherein most class ...
2 votes
3 answers
3k views
Why do we use fields & properties instead of just a variable? [duplicate]
Possible Duplicate: What is the difference between a field and a property in C#? Difference between Property and Field in C# .NET 3.5+ I have seen that in c# the following pattern is common: ...
3 votes
3 answers
571 views
Why can fields be used as out/ref parameters and not properties? [duplicate]
What makes properties and Fields different when we are passing Fields as an out/ref parameter . Does the difference between the two is memory allocation?
0 votes
2 answers
2k views
Differences between getter and setter and a regular variable[C#] [duplicate]
I've learned about the getter and setter topic and i couldn't understand the new type of this topic : Let's say someone is declaring a new get&set method : public int Id { get; set; }; What i ...
1 vote
2 answers
151 views
automatic properties in C# [duplicate]
Need to understand the benefit of using automatic properties apart from less line of codes? Intially we used as below : private int sample; public int Sample { get {return sample}; set {this....
1 vote
4 answers
120 views
Creating a function for getting a variable value [duplicate]
Should I prefer getting variable from other class directly(int number = something.number;) or should I use a function for getting that number(like in example below)? What is the difference? class ...
0 votes
3 answers
164 views
Structs like enums [duplicate]
Possible Duplicate: Difference between Property and Field in C# .NET 3.5+ Sample code: public struct State { private readonly byte state; private State (byte pState) { state =...
1 vote
3 answers
282 views
Why should I use a Field when I can use a Property? [duplicate]
Possible Duplicate: Difference between Property and Field in C# .NET 3.5+ Why should I use an automatically implemented property instead of a field? Both Examples below do exactly the same, have ...
-3 votes
1 answer
80 views
What is the difference between these properties declarations? [duplicate]
I see that i can declare public properties in two ways. Both of them have get / set accessors, but what is the difference between them? class Job { public int Interval { get; set; } public ...
2 votes
1 answer
194 views
Why use member variables at all? [duplicate]
Possible Duplicate: Difference between Property and Field in C# I started a new job a couple of weeks ago using C# (something I've basically started learning -since- being there) and I've seen a ...