I got the following code to generate a DLL :
public class QtObject : DependencyObject
{
public int speedSimu
{
get { return (int)GetValue(speedSimuProperty); }
set { SetValue(speedSimuProperty, value); }
}
public static readonly DependencyProperty speedSimuProperty =
DependencyProperty.Register("speedSimu", typeof(int), typeof(QtObject), new PropertyMetadata(0));
public int rpmSimu
{
get { return (int)GetValue(rpmSimuProperty); }
set { SetValue(rpmSimuProperty, value); }
}
public static readonly DependencyProperty rpmSimuProperty =
DependencyProperty.Register("rpmSimu", typeof(int), typeof(QtObject), new PropertyMetadata(0));
public int nbSimu;
}
public class Timer : DependencyObject
{
public string description
{
get { return (string)GetValue(descriptionProperty); }
set { SetValue(descriptionProperty, value); }
}
public static readonly DependencyProperty descriptionProperty =
DependencyProperty.Register("description", typeof(string), typeof(Timer), new PropertyMetadata("This is a time"));
public bool isActive
{
get { return (bool)GetValue(isActiveProperty); }
set { SetValue(isActiveProperty, value); }
}
public static readonly DependencyProperty isActiveProperty =
DependencyProperty.Register("isActive", typeof(bool), typeof(Timer), new PropertyMetadata(true));
}
public class AnotherClass
{
//blaaa
}
I now would like to ONLY get DependencyObject/Properties. (ie without property "nbSimu" and without object "AnotherClass")
Here is the code I have :
var library = Assembly.LoadFrom(libraryPath);
IEnumerable<Type> types = library.GetTypes();
var libs = types.Where(t => true);
foreach (Type type in libs)
{
foreach (PropertyInfo property in type.GetProperties())
{
//TODO
}
}
On the 3rd line I tried :
var libs = types.Where(t => t.BaseType == typeof(DependencyObject));
It doesn't say any error, but doesn't filter anything...
And about filtering the DependencyProperties, I just got no idead about how to do it...
Thanks in advance for any help on it, on both problems.
It works on my comp.
What about second problem.. you should keep to naming convention of your properties/fields