properties

Is there any way to create default property implementations for C# interfaces

I like the technique of creating extension methods against interfaces to provide default functionality. One of the places it is very handy is in putting some meat on dummy classes for unit tests. For example, public interface IEmployee { IAddress Address { get; set; } IAddress GetAddress(); void SetAddress(IAddress addres...

Test if property throws exception with nunit

Hi, it seems there are no delegates to properties. Is there a convenient way to do the following? Assert.Throws<InvalidOperationException>( delegate { // Current is a property as we all know nullNodeList.GetEnumerator().Current; }); ...

/public/rails folder missing

In new rails installation the rails application doesn't contain the /public/rails/ folder and you can't see application properties from the default index.html page ...

How to get control's property value from string in asp.net

I need to loop through all controls on ASP.NET webpage. In configuration file I have a list of control types and their properties which will I handle in some way. Now, I am interested in following: how can I get that needed property, when all I have are strings, ie names of types of controls and names of their respective properties. Her...

How to define and implement properties in protocol

Hi, I want to define one protocol with few properties and need to use those properties in another NSObject subclass. Please give me link or example code. I need that to work with 10.5. Thanks PLEASE CHECK THE FOLLOWING SAMPLE CODE @protocol MyProtocol @property (nonatomic, readonly) id someObject; @property (nonatomic, getter=is...

Storing property value names as String constants - performance and memory usage?

I use around 1000 properties associated with a specific java.util.Properties which is backed by a file. The main reason for the file is to change them without recompiling the program and to allow users to adjust their according to their taste. Some of the properties are used only in one place in the code, but there are some properties th...

Does JavaScript allow getters and setters?

this is my code: <script type="text/javascript"> var Note=function(){} Note.prototype = { get id() { if (!("_id" in this)) this._id = 0; return this._id; }, set id(x) { this._id = x; } } var a=new Note() alert(a.id) </script> this style is like to python , this is my first...

Purpose of automatic properties in .NET.

Why is this: public string Foo {get;set;} considered better than this: public string Foo; I can't for the life of me work it out. Thanks David ...

How does delphi convert ModalResult properties?

Hopefully this is a quick one, and "Easy if you know how"... I'm writing some kind of Serialization/Scripting class to generate forms on the fly, I tried setting a TColor the other day and got an error clBtnFace is not a valid integer value or something like that and found that the constants used in properties are registered so that th...

How to set up a class two steps down?

I'm getting a little confused how to set up a class that's two steps below the top-most one. For instance, say I have a game called BoardGame. One of whose parameters in numberOfSquares. The classes are setup like this: BoardGameSetupViewController > BoardGamePlayViewController > GameEngine BoardGameSetupViewController creates an ins...

C# ambiguity error when properties are used

I've recently started learning C#. I just learned about properties and decided to make a simple program in order to understand them more. this is the code I wrote: class Dog { private int weight; private string colour; public string colour { get; set; } public Dog(int theWeight, string theColour) { weight =...

How can I deserialize properties which don't have an in built converter?

This is a spin off from my last question How does delphi convert ModalResult properties? Since Delphi doesn't convert ModalResult properties, what's the best way for me to convert ModalResult properties to integers? I don't really want: If SpecialCase then else if AnotherSpecialCase then else BehaveNormally So how do I convert value...

Using multiple property files (via PropertyPlaceholderConfigurer) in multiple projects/modules

We are currently writing an application which is split into multiple projects/modules. For example, let's take the following modules: myApp-DAO myApp-jabber Each module has its own Spring context xml file. For the DAO module I have a PropertyPlaceholderConfigurer which reads a property file with the necessary db connection parameters...

Enumerate the properties of an AS3 object that may or may not be dynamic

In order to send a POST request I need to enumerate all properties of a given object. This object may or may not be dynamic. I'm looking for the most elegant solution. This is what I've got so far: function createURLVariables(params:Object):URLVariables { // Workaround: Flash Player performs a GET if no params are passed...

Class Definition properties or methods?

I have a class definition that I've seen other define properties that return collections of objects. Public Property GetAllAdults() as Adults ... End Property I made the argument that this should be a method in the class, because it doesn't define an attribute of the class, and could not be extended with parameters. Is/Are there reaso...

What happens with Unused Class Properties

I am interested to know what happens with unused properties of a class when an object is instantiated? Are there performance hits for having additional unused properties? What about complex properties that are accessing the database, but I'm not using them, are they still being loaded? ...

Are IBOutlet properties required to be nonatomic?

Getting up to speed with Cocoa iPhone/Mac development, I know the difference between atomic and nonatomic properties, and the performance difference with nonatomic, but every definition of IBOutlet properties I've seen specifies nonatomic, over the default atomic. I've not been able to find an explanation of whether this is a requirement...

How can i extract word 2003 doc properties from linux command shell?

How can i extract word 2003 doc properties from linux command shell? E.g extract the properties: title, summary, keywords, author, etc I am writting a set of php functions for use ina project that needs to extract meta data from various file formats. Can anyone help? ...

Cannot get PropertyInfo.SetValue() to set the value on my object.

I've simplified the code below down to a basic example, but I still cannot get the value to set. When performing the propertyInfo.SetValue(), it will hit a breakpoint on the setter of my Contact object and the value is set correctly in the 'setter.' However, after the SetValue() has executed, the string properties on my projectContact....

access a variable of another class via a property

hi all, I have two classes,In classA I create a variable that I need to use in classB , should i use property ? is there anyone to explain me easier ,how to set StringValue of variable in one class to the textfield of another class? thanks ...