Questions tagged [getproperties]
49 questions
105
votes
11 answers
Get properties in order of declaration using reflection
I need to get all the properties using reflection in the order in which they are declared in the class. According to MSDN the order can not be guaranteed when using GetProperties()
The GetProperties method does not return properties in a…

Magnus
- 45,362
- 8
- 80
- 118
29
votes
6 answers
How do you get the all properties of a class and its base classes (up the hierarchy) with Reflection? (C#)
So what I have right now is something like this:
PropertyInfo[] info = obj.GetType().GetProperties(BindingFlags.Public);
where obj is some object.
The problem is some of the properties I want aren't in obj.GetType() they're in one of the base…

Davy8
- 30,868
- 25
- 115
- 173
13
votes
5 answers
How to read Android properties with Java
I use 'adb shell getprop' in the terminal.
What interfaces can I use in Android JAVA to get the same information?
I have tried several things like:
Properties sysProps = System.getProperties();
But I don't think these are the same properties I am…

TMont
- 213
- 1
- 2
- 7
12
votes
2 answers
how to get file properties?
I want an application which displays the some file properties of a mediafile if available, like (don't know the exact english words used in windows for it) FileName, Length/Duration, FileType(.avi .mp3 etc.)
I tried taglib and windowsapishell but I…

ComputerIntelligentAgent
- 131
- 1
- 1
- 5
5
votes
2 answers
Big-O of .GetProperties()
If there are n properties, then is the Big-O of .GetProperties O(n) or are there are processes involved in the reflection that add complexity?
Say there is this defined class:
public class Reflector
{
public string name { get; set; }
public int…

Travis J
- 81,153
- 41
- 202
- 273
5
votes
1 answer
Filtering out protected setters when type.GetProperties()
I am trying to reflect over a type, and get only the properties with public setters. This doesn't seem to be working for me. In the example LinqPad script below, 'Id' and 'InternalId' are returned along with 'Hello'. What can I do to filter them…

mcintyre321
- 12,996
- 8
- 66
- 103
5
votes
1 answer
Getting IMEI number using ADB commands Android 12
For android versions before 11 I was using the below command to get IMEI number from my device:
adb shell "service call iphonesubinfo 4 | cut -c 52-66 | tr -d '.[:space:]'"
or
adb shell service call iphonesubinfo 1 | toybox cut -d "'" -f2 | toybox…

Joãozinho Pereira
- 51
- 2
5
votes
2 answers
When using reflection to get at properties, How can I limit my search to just the subclass I'm interested in?
After successfully getting a list of specific types out of an assembly using reflection, I now want to get at the public properties of each of those.
Each of these types derives from at least one base class.
I notice when I get properties on a type…

topwik
- 3,487
- 8
- 41
- 65
5
votes
2 answers
How get properties of one class without custom class types
I have a Person class :
public class Person
{
virtual public long Code { get; set; }
virtual public string Title { get; set; }
virtual public Employee Employee { get; set; }
}
I need to a generic solution for get all properties…

Ehsan
- 3,431
- 8
- 50
- 70
4
votes
1 answer
Get DependencyProperties using reflection (Type.GetProperties)?
I got a custom Type that as a couple of fields, and I'd like to only get Dependency Properties.
Here is the code that returns all properties :
propertyInfos = myType.GetProperties();
foreach (PropertyInfo propertyInfo in propertyInfos)
{
…

Guillaume Slashy
- 3,554
- 8
- 43
- 68
4
votes
1 answer
Dynamically change properties returned by ICustomTypeDescriptor.GetProperties to readonly
I have a class which implements ICustomTypeDescriptor, and is viewed and edited by the user in a PropertyGrid. My class also has a IsReadOnly property which determines if the user will be able to save their changes later. I don't want to allow the…

Eric Anastas
- 21,675
- 38
- 142
- 236
3
votes
3 answers
Java getProperties
The command:
System.getProperties().list(System.out);
returns the following:
sun.cpu.isalist=amd64
I can't understand why it's amd64. I have Lenovo with Intel 3i, Win7 (where the code was tested) and Ubuntu. Where is the trick?
Thanks

user1057761
- 53
- 4
3
votes
3 answers
DumpObject with GetFields and GetProperties for instance with nested class
this is my first question in stackoverflow and I am a beginner in using reflection.
I would like to dump all values of an object instance for reference (to keep track about used values on a test). I am using Compact Framework 3.5 not the full…

josef
- 5,951
- 1
- 13
- 24
2
votes
2 answers
Reflection - getting properties of nested objects
refers to : Reflection - setting Type of returned obj?
I have a object Call Jobcard with a few properties, one of which is another object called Customer with its own properties, one of which is another nested object called Adress.
These 2 …

callisto
- 4,921
- 11
- 51
- 92
2
votes
3 answers
C#: Parse different classes as object and display property values the same way
I have a couple of classes in c# console application.
public class Cars:List
{}
and:
public class Drivers:List
{}
The goal is to render console-output always the same manner, doesn't matter if cars or drivers are parsed to…

Jimbo2015
- 21
- 2