properties

Concise C# code for gathering several properties with a non-null value into a collection?

A fairly basic problem for a change. Given a class such as this: public class X { public T A; public T B; public T C; ... // (other fields, properties, and methods are not of interest here) } I am looking for a concise way to code a method that will return all A, B, C, ... that are not null in an enumerable collec...

Implementing multiple properties in different namespaces

I tried to implement IEnumerator< Status > but got errors about two different Properties not being implemented. 'DataReader' does not implement interface member 'System.Collections.Generic.IEnumerator.Current' 'DataReader' does not implement interface member 'System.Collections.IEnumerator.Current' The solution that wo...

@property objective-c syntax

I'm looking for the syntax of the getter/setter. Which is the setter and which is the getter?? Is the readwrite attribute the getter? Is the assign the setter? @interface SomeClass : NSObject { NSString *str; NSDate *date; } @property (readwrite, assign) NSString *str; @property (readwrite, assign) NSDate *date; ...

Pass Variable to Java Method from an Ant Target

At the moment I have a .properties file to store settings related to the framework. Example: default.auth.url=http://someserver-at008:8080/ default.screenshots=false default.dumpHTML=false And I have written a class to extract those values and here is the method of that class. public static String getResourceAsStream(String defau...

c#: what is the point in having a purely public property

Possible Duplicates: Should I use public properties and private fields or public fields for data? Property(with no extra processing) vs public field What is the point in having a property inside a class that simply get and sets a member variable? What practical difference would be there to just making the variable public? ...

Silverlight 4: Binding to a calculation of control properties

What I would like to do is pretty simple. Given textboxes for ItemPrice, Tax and Total, I need the text value for Total to be bound to ItemPrice + Tax and the Tax value to display ItemPrice * taxRate. Could someone offer a brief explanation as to how this would be accomplished or point me to an appropriate example? I see property bindin...

Define a default .properties file depending on language

I have 2 .properties files in my java project and I want to define one of them as default file to be used when the language of the operating system is different from the 2 languages already defined. Can you tell me please what should I add to my code to make that possible? ...

What Getters and Setters should and shouldn't do.

Possible Duplicate: Convention question: When do you use a Getter/Setter function rather than using a Property I've run into a lot of differing opinions on Getters and Setters lately, so I figured I should make it into it's own question. A previous question of mine received an immediate comment (later deleted) that stated set...

C# Using Reflection to Get a Generic Object's (and its Nested Objects) Properties

This is a scenario created to help understand what Im trying to achieve. I am trying to create a method that returns the specified property of a generic object e.g. public object getValue<TModel>(TModel item, string propertyName) where TModel : class{ PropertyInfo p = typeof(TModel).GetProperty(propertyName); return p.GetValue...

Make Eclipse use src/test/resources instead of src/main/resources

Hi! I'm writing a little Maven application in Eclipse. I store some property files and my application context in the directory src/main/resources. I now want to make Eclipse use properties in the directory src/test/resources. So when I run and debug the program in Eclipse, these test properties should be used. Do you know how I could ...

When should we use private variables and when should we use properties. Do Backing Fields should be used in same class ?

In most of the cases we usually creates a private variable and its corresponding public properties and uses them for performing our functionalities. Everyone has different approach like some people uses properties every where and some uses private variables within a same class as they are private and opens it to be used by external envi...

C# Specific Properties

Can I do something like this: Configs.Environment.Development; I'm currently doing something like this: Configs.Environment == "DEV"; I don't particularly care for the strings, but I don't know how to set "specific" properties or if it's possible. ...

Does it make a difference in performance if I use self.fooBar instead of fooBar?

Note: I know exactly what a property is. This question is about performance. Using self.fooBar for READ access seems a waste of time for me. Unnecessary Objective-C messaging is going on. The getters typically simply pass along the ivar, so as long as it's pretty sure there will be no reasonable getter method written, I think it's perfe...

javascript - Google Chrome cluttering Array generated from .split()

Given the following string: var str = "one,two,three"; If I split the string on the commas, I normally get an array, as expected: var arr = str.split(/\s*,\s*/); Trouble is that in Google Chrome (for Mac), it appends extra properties to the array. Output from Chrome's debugger: arr: Array 0: one 1: two 2: three co...

Need a refresher course on property access...

Hi. I need help with accessing class properties within a given class. For example, take the below class: public partial class Account { private Profile _profile; private Email _email; private HostInfo _hostInfo; public Profile Profile { get { return _profile; } set...

javascript object access performance

In Javascript, when your getting a property of an object, is there a performance penalty to getting the whole object vs only getting a property of that object? Also Keep in mind I'm not talking about DOM access these are pure simple Javascript objects. For example: Is there some kind of performance difference between the following cod...

How do I place another attribute to a MKAnnotation?

for my app each annotation on a map corresponds to a mine locality. each mine has its own unique 7 digit integer identifier. I'm trying to add the property minesEntryNumber to the annotation so when the annotation is clicked on later I can bring up specific information on the selected annotation. This is part of my code: for (id min...

using svn only for a property not for entire directory

hi i want to use svn commands only for property of a directory not for the whole directory . e.g. svn revert please tell me what command is used for this purpose. thanks ...

VB.NET generates properties in the release build

I have a form and i drag and drop a control in VB.NET. I have a line say, private WithEvents radioButton RadioButton Also, I have a handler like, private void click(.....) Handles radioButton.Click { ... } Now, When I build this is .NET 3.5 in release mode, and see the generated code in reflector tool, the code is something li...

Get name of maven pom file

I am running a Maven (2) release build with with: mvn -f release.xml clean deploy and want to get the currently running pom file name (release.xml) into a property or mojo. Is it possible? ...