public static int Test(string input) { PdfStream ps = new PdfStream(); ps.FillFromString(input); Dictionary dict = new Dictionary(); try { dict.ReadDictionary(ps); } catch (Exception except) { Console.Write("exception (" + except.Message + ") "); return(-1); } return(dict.Count); }