Department of InformatiX
Microsoft .NET Micro Framework Tools & Resources
Core (2)
WPF (1)
Networking (4)
Emulators (2)
Port specifics


There is no Activator class. How can I create object instances?

Well, the Activator 'contains methods to create types of objects locally or remotely, or obtain references to existing remote objects'. The remoting part is not available in .NET Micro Framework. For local object creation, it practically just wraps working with ConstructorInfo.
You can create your object using ConstructorInfo constructor = typeof(MyTypeToCreate).GetConstructor(Type[] parameterTypes); and calling constructor.Invoke(object[] parameters);.

InvokeMember does throw NotImplementedException. How can I invoke members?

In fact, the InvokeMember throws NotImplementedException even on .NET Compact Framework. This method actually chooses whether to operate on PropertyInfo, FieldInfo or MethodInfo and builds the binding flags for you (can be a bit challenge with COM etc.). In .NET Micro Framework, you have to do this yourself.

For example, if you want to call a method, you can use similar code:
Type t = this.GetType(); MethodInfo m = t.GetMethod("MethodName", BindingFlags.Public | BindingFlags.Instance); m.Invoke(this, new object[] { parameter });
The BindingFlags.Instance (or BindingFlags.Static) is important and the binding would not successfully find the method you are looking for without it.

How can I read attributes?

Custom attributes are not supported on .NET Micro Framework. Some of the system attributes, which do not get stripped by compiler, are accessible using properties, like yourType.IsSerializable.