fieldinfo

How do I get the FieldInfo of an array field?

I'm trying to get the field info of an array value from within a struct. So far I have the following, but I dont see how to get the infomration I want. [StructLayout(LayoutKind.Sequential)] public struct Test { public byte Byte1; [MarshalAs(UnmanagedType.ByValArray, SizeConst=3)] public Test2[] Test1...

Getting the attributes of a field using reflection in C#

I wrote a method that extracts fields from an object like this: private static string GetHTMLStatic(ref Object objectX, ref List<string> ExludeFields) { Type objectType = objectX.GetType(); FieldInfo[] fieldInfo = objectType.GetFields(); foreach (FieldInfo field in fieldInfo) { if(!ExludeFields.Contains(field.Na...

How to get attributes on a referenced field

Hi, I have a question: Is there an elegant way of getting Attributes on a referenced field. Ie.: public class C1: Base { [MyAttribute] public string Field1; } public class Base { private void Do(ref string field) { if (field has attributes) DoSomething(); } } How can I get attributes of a f...

How can I filter FieldInfos that are the underlying implementation of a class event ?

I want to get all the fields of a class without getting the underlying implementations of the class event. type.GetFields(BindingFlags...) returns the nuderlying delegate for event fields. Does anyone knows how to filter them out ? ...