getproperties

how to get file properties?

大憨熊 提交于 2019-11-28 00:05:11
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 dont get a working result (references are good) ShellFile so = ShellFile.FromFilePath(file); so.Properties.System.(everythingIwant) shows me a lot of file properties which I want to have displayed, but I cant get it working An example of an error: 'WindowsFormsApplication2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly

How do you get the all properties of a class and its base classes (up the hierarchy) with Reflection? (C#)

倖福魔咒の 提交于 2019-11-27 04:36:26
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 classes further up. If I stop the debugger and look at obj, the I have to dig through a few "base" entries to see the properties I want to get at. Is there some binding flag I can set to have it return those or do I have to recursively dig through the Type.BaseType hierarchy and do GetProperties on all of them? Panos Use this: PropertyInfo[] info = obj

how to get file properties?

倖福魔咒の 提交于 2019-11-26 21:39:11
问题 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 dont get a working result (references are good) ShellFile so = ShellFile.FromFilePath(file); so.Properties.System.(everythingIwant) shows me a lot of file properties which I want to have displayed, but I cant get it working An example of an error:

Get properties in order of declaration using reflection

安稳与你 提交于 2019-11-26 12:19:53
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 particular order, such as alphabetical or declaration order. But I've read that there is a workaround by ordering the properties by the MetadataToken . So my question is, is that safe? I cant seem find any information on MSDN about it. Or is there any other way of solving this problem? My current implementation looks as follows: var props = typeof(T)