Can the type of an asset be determined by it's xnb file?

Given a .xnb file, is it possible to determine the asset type the file represents? For example, if I had a .png labelled “image.png”, could I determine that I should load it as a Texture2D by analyzing “image.xnb”?

I was looking through the Monogame source for ContentReader and ContentManager, but I couldn’t figure out anything useful. Any ideas?

XNB file format documentation.
http://xbox.create.msdn.com/en-US/sample/xnb_format

You need to parse the file up to ‘Object: Primary asset data’. For monogame generated xnb you have to go through the monogame code again for any extensions (compression, target platforms). From the documentation:

“This format starts with a 7BitEncodedInt typeId, which indicates the type of the object:
• If typeId is zero, the object is null.
• If greater than zero, (typeId - 1) is an index into the type reader table from the XNB header. Nonzero ids are followed by the object data, in the same format as a raw value for the selected type reader.”