7
Antworten
Für Eigenschaften gibt es GetGetMethod und GetSetMethod so dass ich tun kann: Getter = (Func<S, T>)Delegate.CreateDelegate(typeof(Func<S, T>), propertyInfo.GetGetMethod()); und Setter = (Action<S, T>)Delegate.CreateDelegate(typeof(Action<S, T>), propertyInfo.GetSetMethod()); Aber wie gehe ich über die FieldInfos? Ich bin nicht auf der
1
Antworten
Schrieb ich eine Methode, die Felder extrahiert aus einem Objekt wie diesem: 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.Name))
3
Antworten
Ich versuche, das Feld info ein array-Wert innerhalb einer struct. Bisher habe ich Folgendes, aber ich sehe nicht, wie man die Informationen, die ich möchte. [StructLayout(LayoutKind.Sequential)] public struct Test { public byte Byte1; [MarshalAs(UnmanagedType.ByValArray, SizeConst=3)] public Test2