|
This might be a bit of an anti-pattern, but it is possible for a property on a C# class to accept multiple values?
For example, say I have an Public int property and I always want it to return an int, but I would like to be able to have the property set...
Started by lomaxx on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
You could have the property accept.
It seems like you would have to ascertain the type at run-time .
A property has.
Conversion in the assignment statements as opposed to in the property-setter.
|
|
Is there a NAnt task that will echo out all property names and values that are currently set during a build? Something equivalent to ant's echoproperties task maybe.
Started by serg10 on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Try this snippet:
<project> <property name="foo" value="bar"/> <property name="fiz" value="buz"/> <script language="C#" prefix="util" > <code> <.
Own property echoes.
|
|
I read about Compound property names in the " The Spring Framework (2.5) - Reference Documentation - chapter 3.3.2.7 "
Can i use the same concept to set values of properties? Can i use a compound string as a value expression?
<bean id="service1" class...
Started by Daniel Murygin on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It would look something like this:
public class UserFactory use a plain old factory bean, rather... .
Edit: (Oh I see what you are asking.) I think that the answer a [FactoryBean][1] to expose the property.
Data' objects via property editors.
|
Ask your Facebook Friends
|
I have a List of Foo. Foo has a string property named Bar. I'd like to use linq to get a string[] of distinct values for Foo.Bar in List of Foo.
How can I do this?
Started by TheDeeno on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Wayyy nicer....
Try this:
var distinctFooBars = (from foo in foos select foo.Bar).Distinct().ToArray();
This should work if you want to use the fluent pattern:
string[] arrayStrings = fooList.Select(a => a.Bar).Distinct().ToArray();
I'd go lambdas.. .
|
|
I have the following classes:
public class Person { public String FirstName { set; get; } public String LastName { set; get; } public Role Role { set; get; } } public class Role { public String Description { set; get; } public Double Salary { set; get...
Started by Jeffrey on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Public static List....
The name of the property in dot-notation so that you could see what is different -- or it may to recursively pass the object property (Role) back to DiffObjectsProperties to iterate its property values.
|
|
I have a number of objects, each one have an arbitrary number of shared, and distinct property-value pairs (more specifically: files, and their related properties -such as width, and height values for images, album/artist/length for music files, etc)....
Started by Silver Dragon on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Or BerkeleyDB ?
Have a look at the databases offered by various Cloud services:
Google AppEngine Datastore... .
Have a look a a RDF API (see JENA , sesame, virtuoso ) .
Searching for an object having some properties makes me think about a RDF datastore.
|
|
Hello,
I'm writing a custom user control for my asp.net site, for storing datetimes. It has two properties:
Private _includeTime As Boolean Private _value As DateTime = Nothing Public Property IncludeTime() As Boolean Get Return _includeTime End Get Set...
Started by Tominator on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The Get method for the SelectedDateTime property rebuilds to, the SelectedDateTime....
If you want values property rather than the underlying _value field.
Where your control lives, and therefore a new instance of the control itself .
|
|
I'm trying to create an export Excel/CSV function that will iterate through a custom object and first output the property names and then output the values. I want to use reflection only where necessary so I'm attempting to save the property names when...
Started by mga911 on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Properties { get { return _values; } } protected void SetValue<T>(string property, T value) { if (_values.ContainsKey(property)) { _values[property] = value; } else { _values.Add(property....
|
|
You know how a TreeView control's ImageList property lists all ImageLists on a form? I need something similar, but with a list of strings. It's like an enumeration, but defined at runtime, with the object that exposes the property in a PropertyGrid.
So...
Started by Kawa on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You'll need to override the GetStandardValues method..
If it's just a list of strings you need, take a look at writing your own TypeConverter .
This article on CodeProject explains how to write a custom TypeConverter or UITypeEditor .
|
|
I have a custom control that print the current date into the page. The control has a Format property for setting witch DateTime property to be printed. (Date, Day, Year etc...)
<TSC:DateTimeWriter runat="server" Format="Year" />
But what i want ...
Started by Thomas Sandberg on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Day, Year }
}
then add a property to your control:
/// <summary> /// Date Format /// < property an enum instead of a string, VS will be able to display a list of supported formats.
|