Reflecting on .NET Core

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




If you have started migration of old .NET to .NET Core, you have probably figured out that working with methods and properties, which reflect type information is slightly changed.

Following are some examples of this:




object value = type.CreateInstance(this.hasDefaultCtor);
object value = Activator.CreateInstance(this.type);

That means that instead of writing myInst.GetType().IsEnum(), you will have to write now myInst.GetType.GetTypeInfo().IsEnum.

This does not look as a breaking change, but it can be very painful. Good news is that reflection will become the same as the .NET Framework. That means no need for GetTypeInfo(), good old .GetType() will BE back.

Posted Jul 15 2016, 06:19 PM by Damir Dobric
Filed under: is a .Net Community Blog powered by daenet GmbH.