properties

Getting the used file name from a Properties instance

An instance of java.util.Properties is passed to me which has been created using: [...] properties = new java.util.Properties(); try { properties.load( AutoProperties.class.getClassLoader().getResourceAsStream(propertyFile) ); } [...] I was wondering how I could retrieve the file name (propertyFile above) from the properties ...

Parsing enums from property file

I have a simple key-value property file where I need to parse a value which is then to be assigned to an enum type. What is the best way to do this? The only thing that comes up to my mind is something like iterating through all the possible values of the enums.toString and see if it equals any of them. ...

How to catch last iteration inside $.each in jQuery?

var arr = {'a':fn1,'b':fn2,'c':fn3} $.each(arr,function(name,func){ (do something particular for the last iteration) ... }) It'll be best if no additional variables are used. EDIT: I mean LITERALLY last one,which is the last pair I type them. ...

WPF: How do I inherit property values to all child controls?

I have UserControls containing other controls. I want that if I set a Foreground color for the UserControl, all child controls automatically inherit it. I have the same problem with font style/size. Can I set these properties somehow to auto/inherit? Is this possible to set all subcontrols without a loop? ...

C# Passing properties by reference

Hey guys I'm trying to do do the following. GetString( inputString, ref Client.WorkPhone) ... private void GetString(string in, ref string out) { if (!string.IsNullOrEmpty(in)) { out = in; } } This is giving me a compile error, I think its pretty clear what I'm trying to achieve basically I want GetStrin...

Access solutioninfo.cs and assemblyinfo.cs from within .csproj

I need to access some information from my solutioninfo.cs and assemblyinfo.cs within my .csproj file and use it as a property. use the value of // my solutioninfo.cs [assembly: AssemblyCompany("MyCompany")] in my csproj: // my .csproj <PublisherName>MyCompany</PublisherName> Is there a way to access the values? ...

Accessing C# property name or attributes

I would like to automatically generate SQL statements from a class instance. The method should look like Update(object[] Properties, object PrimaryKeyProperty). The method is part of an instance (class, base method - generic for any child). Array of properties is an array of class properties, that will be used in update statement. Proper...

Is it "bad" to use @properties for private variables just for the memory management benefits?

Is it bad to create @properties for private variables just for the memory management benefits? It seems messy and wrong to have public facing @properties for many private variables. (Mainly, I am releasing private ivars during low memory conditions using the respective "event" methods.) Example: I usually do this to release a private ...

XML hierarchy with Java properties

Let's say I have a class Foo with some primitive instance variables. I initialize these with properties in XML files. Now every Foo also has a Bar as a variable, which in turn has its own properties. Since these are tied to the enclosing object, it would make sense to keep them in the same file. How should I format the XML so that it can...

Pass values from one to another page

How we can pass the values from a child window to the parent window in silverlight 3 by using Properties (ie Databinding). In my work, it includes a parent window and a child window. The child window contains a text box, which returns a value after the hitting OK button it to Parent window. I already did this by using message sending an...

Generate Expression<> for filtering by a arbitrary property

I want to write filtering controls which take object type T and property name and return Expression<Func<T, bool>> that checks value of passed property. I don't want to use reflection because I'm afraid such expressions can't be used by EF. I can't use delegates because C# doesn't have delegates for properties. What can I do? Maybe I sho...

[C#] Is it possible to "extend" the property "class"?

Hello, I'm new to C# (started last week) so be cool with me ;). I'd like to know if I can somehow write a custom property, let me explain: I have some partial classes that I complete by adding properties, but the pattern of all the getters and setters are the same so I'd like to factorize this: public partial class Travel { publ...

use ${property} in a properties file ?

Hi, look at my "file.properties": key1= My name is key2= ${key1} Martin ! Why when I get the value of "key2" my result is "${key1} Martin !" unlike "My name is Martin !" => I program in Java 6 => I use java.util.Properties ...

My DataGridView properties window went blank!!

I'm using Visual Studio 2005 w/.NET 2.0. I have no idea what happened, but all of a sudden I noticed that the Properties window for ALL of the DataGridViews in my project went blank. I've tried dropping in new ones..still blank. I restarted Visual Studio and my computer...still blank. I've done some google searches, and I've found pe...

Why am I getting an error messaging when trying to set default value of public method a color?

I have something like this: [Description("Sets the color."), Category("Values"), DefaultValue(Color.White), Browsable(true)] public Color MyColor { get { return myColor; } set { myColor = value; } } private Color myColor = Color.White; I'm getting an error at this line: DefaultValue(Color.White...

How to attach properties (thru .NET infrastracture or any else)

I have a WPF application and I added to the project resources many icons and bitmaps. Now I can access them like this: Dim ico As System.Drawing.Icon = My.Resources.Icon 'Icon.ico Dim img As System.Drawing.Bitmap = My.Resources.Image 'Image.png In order to use it in wpf I created too simple Extension Methods that convert them to Imag...

Binding to a read-only getter in AS3

Consider the following code: [Bindable(event="ReportHeaderVO_effectiveFromDateJulian_updated")] public function set effectiveFromDateJulian ( value:Number ) : void { _effectiveFromDateJulian = value; dispatchEvent( new FlexEvent("ReportHeaderVO_effectiveFromDateJulian_updated") ); } public function get effectiveFromDateJulian (...

ASP.NET Web Forms: Is it smart to call a custom "Bind" method in a user control's property's setter?

I haven't touched ASP.NET Web Forms in years and I'm a bit rusty with it. I currently have a user control which has a list of editable articles, this user control contains another user control (EditArticle.ascx), which is not visible on load. EditArticle has a property called Article which reflects the article one could edit. However ...

Constructing Dynamic Properties at Runtime in VB .NET

Is there a way to dynamically create properties at runtime in VB .NET using introspection? e.g. Suppose I had a class Public Class Foo Public Property Bar() As String get ... end get set(ByVal value As String) ... end set End Class Is there a way to create property Bar at runtime? T...

Use cases for flexible properties

I've been reading about using flexible properties instead of strongly typed fixed properties by using Dictionary or something similar to store them in. An obvious advantage for using flexible properties is that you can change what properties an object has at runtime. What are some interesting use cases for this kind of behavior? Some r...