public static string getName(IMediaPlayer mp) { if (mp == null) { return("null"); } else if (mp is TextureMediaPlayer) { StringBuilder sb = new StringBuilder("TextureMediaPlayer <"); IMediaPlayer internalMediaPlayer = ((TextureMediaPlayer)mp).InternalMediaPlayer; if (internalMediaPlayer == null) { sb.Append("null>"); } else { sb.Append(internalMediaPlayer.GetType().Name); sb.Append(">"); } return(sb.ToString()); } else { return(mp.GetType().Name); } }