Questions tagged [getproperty]

84 questions
257
votes
3 answers

BindingFlags.IgnoreCase not working for Type.GetProperty()?

Imagine the following A type T has a field Company. When executing the following method it works perfectly: Type t = typeof(T); t.GetProperty("Company") Whith the following call I get null though Type t = typeof(T); t.GetProperty("company",…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
55
votes
5 answers

Java's "os.name" for Windows 10?

In Java, we can see the property value of os.name to know the name of the underlying operating system: System.getProperty("os.name"). For each edition of Windows, it used to return always the exact name of the OS: Windows XP for XP, Windows Vista…
29
votes
6 answers

Best way to get sub properties using GetProperty

public class Address { public string ZipCode {get; set;} } public class Customer { public Address Address {get; set;} } how can I access eitther "ZipCode" or "Address.ZipCode" with reflection? For example:…
Todd Smith
  • 17,084
  • 11
  • 59
  • 78
26
votes
5 answers

Convert to a Type on the fly in C#.NET

Alternative Title: Dynamically convert to a type at runtime. I want to to convert an Object to a type that will be assigned at runtime. For example, assume that I have a function that assigns a string value(from a TextBox or Dropdownlist) to an…
nAviD
  • 2,784
  • 1
  • 33
  • 54
14
votes
1 answer

How does adb shell getprop and setprop work?

I would like to understand how adb shell setprop mypropertykey mypropertyvalue works. In other words, I edited the /system/build.prop file, but when I try to use getprop command to read the value back I seem to be getting a blank value…
11
votes
4 answers

how to retrieve nested properties in groovy

I'm wondering what is the best way to retrieve nested properties in Groovy, taking a given Object and arbitrary "property" String. I would like to something like this: someGroovyObject.getProperty("property1.property2") I've had a hard time…
Nathan Beach
  • 2,497
  • 2
  • 24
  • 25
7
votes
2 answers

Android KSoap2: how to get property name

I am using KSoap2 for calling web-services for my Android app. I am using following code to call the web-service. SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("PageSize", 20); request.addProperty("PageIndex",…
dev_android
  • 8,698
  • 22
  • 91
  • 148
5
votes
1 answer

C# GetValue of PropertyInfo with SubClasses

First of all, sorry for my bad English... I hope you'll understand what I want to say. I have a problem with a little code where I need to get the value of class' properties. (That's not my full project, but the concept of what I want to do. And…
Kevin Joss
  • 53
  • 4
3
votes
1 answer

Getting an interface from GetPropValue

I want to dynamically get a property value from an object instance. I was able to get the class properties, ordinal types and strings. The delphi source of the GetPropValue does not support tkInterface. Is there any way of getting the interface…
Rahul W
  • 833
  • 11
  • 26
3
votes
2 answers

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property

package com.merchantPlatform; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.DesiredCapabilities; public class MerchantPlatformTest…
nsCelin
  • 107
  • 1
  • 2
  • 5
3
votes
3 answers

Java system.getProperty issue

I found that on my OSX system I have "weird" setup. Java reads my user name as "root" instead of my actual user name. Turns out the code I used uses System.getPropery("user.name") call. So, I made up stand-alone snipped (I save it under test.java)…
Valentin
  • 1,492
  • 3
  • 18
  • 27
2
votes
1 answer

Trying to find property names given deeply nested classes / objects

I'm digging into an object which contains "values" in a string format that correspond to objects and properties nested within the object I get said values from. I.E. If my object contains a list of nested objects that contains, say.. Name, within a…
BMcKinley
  • 21
  • 2
2
votes
2 answers

javascript getProperty

I'm a complete beginner trying to learn Javascript. I am trying to complete a problem requiring me to return a value assigned to a key. The function is called getProperty and I am stuck - it keeps returning "should return the value of the property…
Doug
  • 79
  • 1
  • 1
  • 4
2
votes
1 answer

(C#) How to store value based on the name field?

I have a ArrayList with names of a fields in the current object, when i try to do this: foreach(string name in array) { PropertyInfo property = this.GetType().GetProperty(name); property.SetValue(this, value , null); } The execute is failed,…
manhattan
  • 133
  • 2
  • 10
2
votes
1 answer

Properties Class getProperty() internals

I have a huge file which contains lines in key=value format. If i wish to get the value of a particular key using getProperty() method of Properties class in java , is the complete file loaded into memory before the getProperty() operation is…
sujith
  • 665
  • 2
  • 9
  • 22
1
2 3 4 5 6