properties

C# - Store and then update a property

Evening all, I've written a transfer application that needs to perform an update, then update a date corresponding to that update. I.e. string content = string.Empty; IIvdManager manager; DateTime configDate; if (table == Tables.Asset) { content = WebService.GetTblAsset(companyId); manager = ivdData.Instance.Asset; configD...

Does this copy class method leak memory?

- (id)copyWithZone:(NSZone *)zone { PoolFacility *copy = [[[self class] allocWithZone:zone]init]; copy.name = [self.name copy]; copy.type = [self.type copy]; copy.phoneNumber = [self.phoneNumber copy]; //make sure I get proper copies of my dictionaries copy.address = [self.address mutableCopy]; copy.webAddre...

How to set the value of a read-only property with generic getters and setters?

Not sure if I worded this correctly ... but I have the following code: public Guid ItemId { get; } public TransactionItem() { this.ItemId = Guid.Empty; } Naturally I am getting a read-only issue ... which I do understand. Is there anyway to set this property value without having to do somethin...

A better class to update property files?

Though java.util.properties allows reading and writing properties file, the writing does not preserve the formatting. Not surprising, because it is not tied to the property file. Is there a PropertyFile class out there -- or some such -- that preserves comments and blank lines and updates property values in in place? ...

Iterating over class properties

I'm trying to iterate over the Color class' Color properties. Unfortunately its not in a collection so its just a class with a bunch of static properties. Does anyone know if its possible to iterate over a class' properties be it static or object based? ...

Why are C# collection-properties not flagged as obsolete when calling properties on them?

I tried to flag a collection property on a class as Obsolete to find all the occurances and keep a shrinking list of things to fix in my warning-list, due to the fact that we need to replace this collection property with something else. Edit: I've submitted this through Microsoft Connect, issue #417159. I will post an update if I get...

C# setting multiple properties through a single assignment

I have a property that is assigned as: public string propertyA{get;set;} I want to call a method automatically when this property is set to assign another property in the class. Best way to trigger the call? ...

In actionscript, what's the best way to check if a xml node property exists?

If I have some xml like so: <books> <book title="this is great" hasCover="true" /> <book title="this is not so great" /> </books> What's the best (or accepted) way in actionscript to check if the hasCover attribute exists before writing some code against it? ...

Flex: How to access properties of component in dynamic creation?

Hello everyone. I have a component which is created dynamically. I want to access the properties on it. for example i create a vbox and i want to access the text font or gap of the component var MyVBox: VBox = new VBox; MyPanel.addChild(MyVBox); How should it be done? ...

Objective-C properties: atomic vs nonatomic

What do atomic and nonatomic mean in property declarations? @property(nonatomic, retain) UITextField *userName; @property(atomic, retain) UITextField *userName; @property(retain) UITextField *userName; What is the functional difference between these 3? ...

Overriding a property with an attribute

I'm trying to find a way to change the serialization behavior of a property. Lets say I have a situation like this: [Serializable] public class Record { public DateTime LastUpdated {get; set; } // other useful properties ... } public class EmployeeRecord : Record { public string EmployeeName {get; set; } // other useful ...

Why can some arrays be published but not others?

type TStaticArray = array[1..10] of integer; TDynamicArray = array of integer; TMyClass = class(TObject) private FStaticArray: TStaticArray; FDynamicArray: TDynamicArray; published property staticArray: TStaticArray read FStaticArray write FStaticArray; //compiler chokes on this property dynamicArr...

PropertyChanged notification for calculated properties

I'm developing an application in Silverlight2 and trying to follow the Model-View-ViewModel pattern. I am binding the IsEnabled property on some controls to a boolean property on the ViewModel. I'm running into problems when those properties are derived from other properties. Let's say I have a Save button that I only want to be enabled...

Having spring bean properties refreshed automatically from properties file

I'm using Spring 2.5.6. I have a bean whose properties are being assign from a property file via a PropertyPlaceholderConfigurer. I'm wondering whether its possible to have the property of the bean updated when the property file is modified. There would be for example some periodic process which checks the last modified date of the pro...

How do I treat two similar types as one?

In VB.NET, I am trying to talk to a webservice (that can't be changed) to create and update customer data. The CreateCustomer service expects an object of type ConsumerPerson and the ChangeCustomer service expects an object of type ChangeData. The properties of these two object are exactly the same, so I thought it would be wise to just...

Properties vs Methods

Quick question: When do you decide to use properties (in C#) and when do you decide to use methods? We are busy having this debate and have found some areas where it is debatable whether we should use a property or a method. One example is this: public void SetLabel(string text) { Label.Text = text; } In the example, Label is a c...

Dumping a java object's properties

Is there a library that will recursively dump/print an objects properties? I'm looking for something similar to the console.dir() function in Firebug. I'm aware of the commons-lang ReflectionToStringBuilder but it does not recurse into an object. I.e., if I run the following: public class ToString { public static void main(String...

How to create a WMI property dynamically?

Hey, I want to create properties dynamically, when the user retrieves the instances of my class. Implementation in c++, but Put can't create properties on the fly. Can someone point me to the function(s) I need to use to "fill" a empty class on the fly with properties and values. Ciao Ephraim ...

What's the motivation for properties?

I'm a bit confused as to why languages have these. I'm a Java programmer and at the start of my career so Java is the only language I've written in since I started to actually, you know, get it. So in Java of course we don't have properties and we write getThis() and setThat(...) methods. What would we gain by having properties? Than...

Spring PropertyPlaceholderConfigurer for .NET web.config/app.config

Is there an equivalent for the Sprint PropertyPlaceholderConfigurer for .NET app.config or web.config files? We are currently using different version of app.config for different environments (web.prod.config, web.qa.config, etc.) which get renamed when the app is deployed. However, most of the config file is the same for each environme...