[mono-android] How to tell is Java.Lang.Object is byte[]

Jonathan Pryor jonp at xamarin.com
Mon Dec 17 19:27:02 UTC 2012


On Dec 17, 2012, at 1:45 PM, Jeremy A. Kolb - ARA/NED <jkolb at ara.com> wrote:
> I’m trying to replicate DatabaseUtils.getTypeOfObject and am running into trouble telling it the object is a byte[].

I assume you have:

	Java.Lang.Object obj = ...;

If so, the easiest way to check that is:

	if (obj.Class.Name == "[B") {
		byte[] contents = (byte[]) obj;
	}

 - Jon



More information about the Monodroid mailing list