# How to go from Texture2DContent to Texture2D in a content processor?

I'm using reflection to create a manifest of all assets, strongly typed.

It's working fine for my own types: I get the type of the asset, if a processor is ran on it I get the output type. Then I check to see if there's a ContentSerializerRuntimeTypeAttribute applied to the type. If so, then I get the RuntimeType value and do a Type.GetType() to get the type back.

The problem I have is if the type is Texture2DContent (for example) as that doesn't have the ContentSerializerRuntimeTypeAttribute.

How can I go from a Type representing Texture2DContent to a Type representing Texture2D?

I know I can just check for EndsWith("Content") as a last resort, but how to I get the namespace qualified type so I can get my Type object?

Find all Types that inherit from ContentTypeWriter and have generic argument of Texture2DContent (actualy i think writer exists only for TextureContent), create instance of them and then call GetRuntimeType
• Instead of getting only ContentTypeWriter<T> for my T i got all writers that had the ContentTypeWriterAttribute and were inherited from ContentTypeWriter. I then instanciated them all and picked the one that had the correct .TargetType. – George Duckett Feb 13 '12 at 15:32