I'm feeling dumb.
public class Uber
{
public Foo Foo { get; set; }
public Bar Bar { get; set; }
}
public class Foo
{
public string Name { get; set; }
}
...
var ubercharged = session.CreateCriteria(typeof(Uber))
.Add(Expression.Eq("Foo.Name", "somename"))
.UniqueResult<Uber>();
return ubercharged;
This throws a "could not r...
I have an application that makes an internet connection from within the application by the click of a button.
When the button is clicked, the sub determines which type of modem is being used, and dials the connection associated to that modem.
My question is:
How can i change the properties for those dial-up connections in the code? Or ...
Does anyone know how to read a x.properties file in Maven. I know there are ways to use resource filtering to read a properties file and set values from that, but I want a way in my pom.xml like:
<properties file="x.properties">
</properties>
There was some discussion about this:
Maven External Properties
...
Hey everyone..
I am trying to store/retrieve a value that is stored in the Application Settings. From within my console application I can not seem to access the Properties.Setting namespace. My web surfing has revealed that a little more work might be needed to do this from within a Console application. How does one do this?
string tes...
Consider the following code:
class Program
{
static void Main(string[] args)
{
Department deathStar = new Department { Name = "Death Star" };
Console.WriteLine("The manager of {0} is {1}.", deathStar.Name, deathStar.Manager.FullName);
deathStar.Manager.FirstName = "Lord";
Console.WriteLine("The...
I have a class that contains a collection. I want to provided a method or property that returns the contents of the collection. It's ok if calling classes can modify the individual objects but I do not want them adding or removing object from the actual collection. I have been copying all the objects to a new list, but now I'm thinking t...
How can i reference a class property knowing only a string?
class Foo
{
public $bar;
public function TestFoobar()
{
$this->foobar('bar');
}
public function foobar($string)
{
echo $this->$$string; //doesn't work
}
}
what is the correct way to eval the string?
...
Please bear with me if this question isn't well formulated. Not knowing is part of the problem.
An example of what I'd like to accomplish can be found in PropertyChangedEventArgs in WPF. If you want to flag that a property has changed in WPF, you do it like this:
PropertyChanged(this, new PropertyChangedEventArgs("propertyName"));
Yo...
Is there any way to find out if a property is mapped to a field.
I would like this to generate something like a "generic like search":
string[] words.
words = search.Split(' ');
Type type = typeof(T);
Disjunction disjunction = new Disjunction();
foreach (System.Reflection.PropertyInfo property in type.GetProperties(...
I currently have a need for a custom ListViewItem class - let's call it MyListViewItem. It needs to have some additional data associated with each item, and perform some operations when the Checked property is changed. I've tried several things, but currently the relevant code looks like this:
class MyListViewItem : ListViewItem {
...
I've got a Customer class that has a List<string> Roles property. Much of the time I want to access that property as a list of strings, but on occasion I want to see it as a comma-delimited list.
I could certainly do that in a new method, and if I anticipated wanting to get the value of the variable in different formats (comma-delimite...
Hi,
I am using reflection to populate the properties of an object.
These properties have different types: String, Nullable(double) and Nullable(long) (don't know how to escape the angle brackets here ...). The values for these properties are coming from a dictionary of (string, object) pairs.
So, for example my class has the followin...
I was wondering, what is the preferred way to construct a new object in C#?
Take a Person class:
public class Person
{
private string name;
private int age;
//Omitted..
}
Should I create it to use:
New Person("name", 24);
or
New Person() { Name = "name", Age = 24 };
Is it just a matter of taste or is there a good...
While reading Jon Skeet's article on fields vs properties he mentions that changing fields to properties is a breaking change.
I would like to understand the common scenarios in which this change can cause breaks. Along with the scenario, if you can, please provide any details.
For starters, the following points have been mentioned els...
Hi,
I'm looking for a way to access all the Build properties defined while executing MSBuild. I have a configuration file. I want to modify the Properties in the configuration file and copy it to a new location. Is there a way to do it?
...
Say I've got an app with a laughably awful GUI setup screen. I could fit 90% of the properties I need to let the user set up with one of those boxes that look like
▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪
▪height ▪ 1.3in ▪
▪width ▪ 3.0in ▪
▪top ▪ 3.2in ▪
▪left ▪ 2.3in ▪
▪caption ▪ 'awesome'▪
▪order ▪ 3rd ▪
▪▪▪...
define a default directory for Input files
dir.default=/home/data/in/
dir.proj1=dir.default /p1
dir.proj2=dir.default /p2
dir.proj3=dir.default /p3
is this possible?
...
The title is pretty self-explanatory: does anyone know of a (good) properties file reader library for C or, if not, C++?
[Edit: To be specific, I want a library which handles the .properties file format used in Java: http://en.wikipedia.org/wiki/.properties]
...
I'm using Apache Commons Logging and SLF4J with log4j, but I also want to use the log4j.properties in a custom place like conf/log4.properties. Here is the problem:
If i use
PropertyConfigurator.configure("conf/log4j.properties");
then my app is tied to log4j and defets the purpose of having ACL and SLF4J.
What is the best way to ...
Java doesn't. (It's just convention)
Delphi does.
I believe C# does.
What other languages do?
Edit:
I should have given an example:
Delphi: (beware, it's been a while, I may get this wrong)
type
TSomething = class
fEmployeeNum: String;
property employeeNum: String read fEmployeeNum write setEmployeeNum;
end;
proce...