properties

Should all the identifiers of static properties with accessors start with uppercase letters?

I can't see anywhere that this should be the case, but I get an "Invalid declaration syntax" error in the get everytime I declare a static property that does not start with an uppercase letter. E.g: type Foo() = class static member bar with get() = "bar" //Invalid declaration syntax in get end ...

Should I access Ivars directly within a class implementation?

I've been sort of on the fence on this one for a while, but I'd like to know what people think about accessing instance variables directly from within an Objective-C class implementation? Using accessors and mutators makes a lot of things easy, but for simple things, is it bad to access the instance variable directly? Is the best practi...

Objective-C 2.0 properties: Why both retain and readonly?

I've noticed that some of Apple's examples include both a retain and readonly modifier on properties. What's the point of including retain if no setter gets generated when we're using the readonly modifier? Example: @property (retain, readonly) NSString *title; from the AnimatedTableView sample. ...

iPhone Objective-C Basic Example Question (about Properties)

Sorry I couldn't give a more descriptive title. My question (after looking at the code below) is what statusText is. Is it an IBOutlet or a UILabel? How does "@property (retain,nonatomic) UILabel *statusText" work? Does that statement mean that statusText is a property??? Thanks for answering. If there are any questions, please feel fre...

iPhone Obj-C Properties

Hi, I'm a beginner following a book for creating iPhone apps. One of the steps was writing "UISwitch *whichSwitch = whichSwitch.isOn;" and I was just curious as to where "isOn" came from? In the documentation: on A Boolean value that determines the off/on state of the switch. @property(nonatomic, getter=isOn) BOOL on What does that...

LINQ to SQL - Format a string before saving?

I'm trying to convert an existing (non-LINQ to SQL) class into a LINQ to SQL entity class which has an existing (db column) property like: public string MyString { get { return myString; } set { myString = FormatMyString(value); } } Is there a way to do this sort of processing on the value of entity class property before savin...

Properties in XML

Is there a special XML element for name/value property pairs like the following, something that I can leverage in C# code? <Properties> <Property> <Name>xyz</Name> <Value>abc</Value> </Property> </Properties> ...

Singleton to read properties file in a Java webapp; correct approach?

Hi, all. My spaghetti monster consumes XML from several different SOAP services, and the URL for each service is hardcoded into the application. I'm in the process of undoing this hardcoding, and storing the URLs in a properties file. In terms of reading the properties file, I'd like to encompass that logic in a Singleton that can be ...

(iPhone,Obj-C) Where does this "view" property come from?

I ran across this segment of code (in .m implementation file in an IBAction instance method): UIActionSheet *actionSheet = [[UIActionSheet alloc] ...]; ... [actionSheet showInView:self.view]; self refers to the button but I wanted to know where I could find out about this "view" property since I looked up UIButton, UIView, NSObject, b...

XAML: What is the functional difference between the following notations?

XAML: What is the functional difference between the following notations? Is there any reason I shouldn't use the first method for properties? <Setter Property="Shape.Stroke" TargetName="circle" Value="#FF3C7FB1"/> <Setter Property="Shape.Stroke" TargetName="arrow"> <Setter.Value> <SolidColorBrush>#FF222222</SolidColorBrush> <...

property inheritance

Public class ClassB : ClassA { } public class GeneralClass { public ClassA test { get{} set{} } } public class specificClass :GeneralClass { public ClassB test { get{} set{} } } As you can see the property test is inherited in specificClass from generalClass but here I want to change the type ...

Can the VC++ debugger evaluate and show _declspec properties?

If I have a "fake" Visual C++ property: int _declspec( property( get = GetFoo ) ) Foo; int GetFoo() const { ... } Is there any way to get the debugger to evaluate this and display it as a normal member variable in the QuickWatch window? ...

Basic C# property question

In C# do properties need to reference private member variables, or can I just declare the properties and use them directly in the class code? If the former is the best practice, then does that rule out using C# property short-hand? I.e. public string FirstName { get; set; } ...

How can I change a config file variable using ant build?

I'm using Jboss 4/5 and have some .war .properties files with default configuration settings I want to update these settings using information from the windows xp environment variables. ${env} in ant ...

Java String formatting

I have a property-file with strings inside, formatted in this way: audit.log.events.purged=The audit events were purged. {0} events were purged, {1} assets were deleted. Is there a way to bind some values inside those {0} and {1}, using some standard APIs, or should I create some code for parsing those Strings? ...

Why use private variables when we can use properties ?

Hi all, Sorry If I am being noob, I have this doubt, why do we use private variables and set them using properties ? Why can't we just use properites alone ? I am talking about situations like this private string _testVariable; public string MyProperty { get { return _testVariable;} set {_testVariable = value;} } I am thi...

Retrieve property from classpath inside POM

For my current project I want to integrate a maven plug-in for database migrations. For this plug-in to work, however, I have to obtain the database settings inside my POM. My database settings are currently placed inside a hibernate.properties file, positioned in a directory that is marked as maven resource. For a variety of reasons I d...

Can I use reflection and a string to get/set the correct property of an object?

Hi All, I am using c# & .NET 3.5. A vendor gives us an object that has properties of UserVarNbr1, UserVarData1, UserVarNbr2, UserVarData2,... UserVarNbrN, UserVarDataN. Not the way I would have coded it but nonetheless, this is what we have to work with. Another object in the application returns a collection of items used to represent th...

How to set a CGFloat to a UILabel's text property

I have a UILabel called optionsDisplayerBrushSizeLabel who's text property I want to set to a CGFloat: brushSizeVal. I understand that the text property needs to be a string but I don't know how to convert a CGFloat to an NSString. ...

Access control's properties from another class in C# WPF

I'm in a mess with visibility between classes. Please, help me with this newbie question. I have two controls (DatePickers from default WPF toolbox) which are in different windows, so in different classes. I can easily access these controls properties like datePicker1.Text from within its native class, i.e. in its native window, but whe...