static FieldInfo GetDecoderField(BitmapDecoder decoder, string fieldName) { FieldInfo streamField = decoder.GetType().GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance); if (streamField == null) { throw new Exception(string.Format("{0}.{1} ({2})", decoder.GetType().FullName, fieldName, decoder.GetType().AssemblyQualifiedName)); } return(streamField); }