Omgili - forum search, search forums  
  

Discussions about private fields

Displaying 1 - 10 out of 60,682 discussions.  
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9   10  
Keep this page open to be updated with the newest discussions automatically.
Hi, What is the difference between using Private Properties instead of Private Fields private String MyValue { get; set; } // instead of private String _myValue; public void DoSomething() { MyValue = "Test"; // Instead of _myValue = "Test"; } Is there...
Started by on , 7 posts by 7 people.  
Other I have seen for private....
With automatic properties in C# 3.0, I rarely see a need to implement fields directly -- private or public.
Private fields do not offer this advantage.
Implementation, even in the same class.
In much of the code I have seen (on SO, thecodeproject.com and I tend to do this in my own code), I have seen public properties being created for every single private field that a class contains, even if they are the most basic type of get; set; like:...
Started by on , 13 posts by 13 people.  
When you use get and set, that means you are changing the ... .
Age { get; set; } instead of the old school way with declaring your private fields yourself like/unintentionally change the value of a class private field outside.
I would like to use reflection to investigate the private fields of an object as well as get the values in those fields but I am having difficult finding the syntax for it. For example, an object has 6 private fields, my assumption is that I could fetch...
Started by on , 5 posts by 5 people.  
BindingFlags.NonPublic | BindingFlags.Instance) Since you want to retrieve both fields and values: from field in myObject.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance) select new { Field = field, Value....
Ask your Facebook Friends
Is there an official convention for naming private fields in VB.NET? For example, if I have a property called 'Foo', I normally call the private field '_Foo'. This seems to be frowned upon in the Offical Guidelines : "Do not use a prefix for field names...
Started by on , 11 posts by 11 people.  
Private fields can for private fields....
I still use the _ prefix in VB for private fields, so I'll have _foo as the private field and Foo is quite common (and obviously, the Official Guidelines ignored).
I want to move all the private fields in a class to the top or at least to a block where they are gathered together. Is there any quick way to achieve this with ReSharper?
Started by on , 4 posts by 4 people.  
You want the feature called....
It's for putting them at the bottom, but should be enough information to get you set up too .
Kindness, Dan I answered a similar question here.
Have you tried the Clean code options? I believe you can set the behaviour there .
I encoutered a somewhat (at least for me) strange behaviour in a library I'm building; I have this method: public class Lib { private string field = "field"; public string Field { get { return field; } } public void Add(Lib lib) { string field = DoSomething...
Started by on , 4 posts by 4 people.  
I declared the field as private, so why can one class of the instance....
Now, I don't quite understand why that happens.
Class...
Nested Types also have access to private fields of the containing Type.
Not an instance of the Type.
Resharper offers a very useful introduce and initialize field xxx action when you specify a new parameter in a constructor like: Constructor (int parameter) The only (minor) nuisance is that it puts the new field at the beginning of the class - and I'...
Started by on , 4 posts by 4 people.  
Public fields and you only want the private ones moved to the bottom then change the match above of the XML layout definition, just move the entry element that groups your fields to the end of the section the following block of XML....
I've seen this de facto standard in many places in many languages, but I've never understood it - why put your private fields and methods at the top of a class declaration? Metaphorically it seems like private things should be located at the bottom (hidden...
Started by on , 13 posts by 13 people.  
It gives me a quick glimpse at the type of things they are doing and what I can expect the datastructures for my methods .
Trying to read somebody else's code and understand it, I like having the context that the private fields provide.
I'm writing a equals(Object obj) function for a class. I see that it is possible to access the private fields of obj from the caller. So instead of using a getter: Odp other = (Odp) obj; if (! other.getCollection().contains(ftw)) { } I can just access...
Started by on , 5 posts by 5 people.  
Any method of the Odp class can modify any private members of any Odp object, even non- this ones that private variables....
To think that this can fiddle with the private fields of other , but it's okay because there's no way.
I'm working in C# 2.0, but this would apply to most object oriented languages. When I create classes with public properties that wrap private fields, I switch back & forth between whether I should use the property or field internally. Of course C# 3.0...
Started by on , 12 posts by 12 people.  
That the values of your private fields have gone through whatever rigors you choose to put in your accessor in every place that you access the field, so you shouldn't skip it even in private methods property rather than the....
Page: 1   2   3   4   5   6   7   8   9   10  
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost