property

missing : after property id code was copied from a working example?

I copied this code and changed the final line "You must the fill in this field." from just "" (blank). The code worked in fine before (in the example) but now I get the error 'missing : after property id' on line one in this case. I checked to see if there was any vars I had missed or anything like that but no. Strange could really do wi...

Get property ID in Windows Forms

Hi, I have images in Resources, and I'd like to get their ID. I dont find the following code from MSDN to be very helpful. How did it get the number 20624 and 20625? If I have image accessible with Properties.Resources.Image1 , how can I programmatically get its ID? private void DemonstratePropertyItem(PaintEventArgs e) { // Crea...

What's an elegant solution to get the property values from two classes (that have the same property names) that do not use inheritance?

Essentially I have to use a poorly implemented web service maintained by other programmers. They have two classes that don't derive from a parent class, but have the same properties (Ughh...). So it looks like this in my web service proxy class file: public partial class Product1 { public int Quantity; public int Price; } publi...

Prompt Property on Spark Combox Component in Flex 4

It appears there is no prompt property for the spark Combobox component as there was with the mx version. Anyone have a simple workaround for this or know something I'm just absentmindedly overlooking? Thanks in advance. ...

C# Late Binding for Parameterized Property

I'm trying to use late binding to connect to a COM automation API provided by a program called Amibroker, using a C# WinForms project. So far I've been able to connect to everything in the API except one item, which I believe to be a "parameterized property" based on extensive Googling. Here's what the API specification looks like acco...

Elegantly Handle Repetitive Property Code in C#

The language shortcut public string Code { get; set; } saves a bit of typing when defining trivial properties in C#. However, I find myself writing highly repetitive, not-quite-as-trivial property code that still follows a clear pattern e.g. public string Code { get { return code; } set { if (code != v...

Get name of property as a string

(See below solution I created using the answer I accepted) I'm trying to improve the maintainability of some code involving reflection. The app has a .NET Remoting interface exposing (among other things) a method called Execute for accessing parts of the app not included in its published remote interface. Here is how the app designate...

Maven: properties not being substituted

I'm using a maven plugin for install4j in my project, located here. That plugin lets you pass variables to install4j using the <compilerVariables> section. Here's the relevant section of my pom: <plugin> <groupId>com.google.code.maven-install4j</groupId> <artifactId>maven-install4j-plugin</artifactId> <version>0.1.1</version...

Ignore collection properties in PropertyInfo

I have a function with this code: foreach (PropertyInfo propertyInfo in typeof(T).GetProperties()){ //SOME CODE if (propertyInfo.CanWrite) propertyInfo.SetValue(myCopy, propertyInfo.GetValue(obj, null), null); } I would avoid to check "collection" properties; to do this now I have insert this control: if (propertyInfo.PropertyTy...

Private Java class properties mysteriously reset between method calls....

I have a very odd problem. A class property is mysteriously reset between method calls. The following code is executed so the constructor is called, then the parseConfiguration method is called. Finally, processData is called. The parseConfiguration method sets the "recursive" property to "true". However, as soon as it enters "proce...

javascript class calling XMLHttpRequest internally, then handling onreadystatechange

this thing almost works: function myClass(url) { this.source = url; this.rq = null; this.someOtherProperty = "hello"; // open connection to the ajax server this.start = function() { if (window.XMLHttpRequest) { this.rq = new XMLHttpRequest(); if (this.rq.overrideMimeType) this.rq.overrideMimeType("text/xml"...

Callers block until getFoo() has a value ready?

I have a Java Thread which exposes a property which other threads want to access: class MyThread extends Thread { private Foo foo; ... Foo getFoo() { return foo; } ... public void run() { ... foo = makeTheFoo(); ... } } The problem is that it takes some short time from the time this runs until...

C# style properties in python

I am looking for a way to define properties in Python similar to C#, with nested get/set definitions. This is how far I got: #### definition #### def Prop(fcn): f = fcn() return property(f['get'], f['set']) #### test #### class Example(object): @Prop def myattr(): def get(self): return self....

Getting set accessor for property in abstract class, not possible?

Given the class': public abstract class AbstractEntity { public virtual Guid Id { get; private set; } } public class Entity { public virtual Guid Id { get; private set; } } And a PropertyInfo for the property 'Id'. When calling the method: PropertyInfo.GetAccessors() It returns both the get-method and the set-method when ...

Search an item based on a custom property

I started this task assuming it to be pretty trivial one. However, going to the depths i find that its either not that simple or may be i am using a wrong approach here. In my case i have a number of documents which are not in the same directory however, they have the same names/title. What i want is to carry out a site based search and ...

Static Property losing its value intermittently ?

Is there something fundamentally wrong with the following design, or can anyone see why would the static properties sometimes loose their values ? I have a class library project containing a class AppConfig; this class is consumed by a Webforms project. The skeleton of AppConfig class is as follows: Public Class AppConfig Implemen...

JSF Managed Property question

I have a search page that I'll called "Parent." The search page references a country lookup page that I'll call "Child." When the user selects a country on Child's page and clicks on OK, I set the country back into the parent page. I do this by calling a method on the Parent page called "UpdateCountryCodeWithLookupValue(Child child)" ...

Autoproperty failing in IronPython works in Python?

I have this following python code, it works fine in python but fails with the following error in IronPython 2.6 any ideas as to why? ====================================================================== ERROR: testAutoProp (__main__.testProperty) ---------------------------------------------------------------------- Traceback (most...

C#: access a class property when the property identifier is known as a string

Hi, I'm using LINQ to Entities on a database which structure is not known in advance. I use reflection to retrieve the information, and now have a list of strings with all the table names. Because I use LINQ, I also have the datasource encapsulated in a C# class (linqContext), with each table being a property of that class. What I want...

Generic property- how to specify the type at run time

I was reading a question on making a generic property, but I'm a little confused by the last example from the first answer (I've included the relevant code below): You have to know the type at compile time. If you don't know the type at compile time then you must be storing it in an object, in which case you can add the follo...