In my Type I have a Method which copies all the fields of the type from the argument's same-type object
i.e.
I'd like to use reflection here instead. My feeble start is below, but I'm a bit lost re Sets Gets and navigating Fields generally.
Any help greatly appreciated!
Thanks.
-David
i.e.
Type MyType Field Field_a:Int Field Field_b:String Method Copy(_source:MyType) Field_a = _source.Field_a Field_b = _source.Field_b End Method End Type
I'd like to use reflection here instead. My feeble start is below, but I'm a bit lost re Sets Gets and navigating Fields generally.
Local self_id:TTypeId =TTypeId.ForObject( Self) Local source_id:TTypeId = TTypeId.ForObject(_source) Local source_field_list:TList = source_id.Fields() Local source_field:TField = TField(source_field_list.First()) For Local self_field:TField=EachIn self_id.EnumFields() self_field.Set Self, source_field.Get() source_field = OK, Now I admit I'm lost! These Sets and Gets confuse me... Next
Any help greatly appreciated!
Thanks.
-David