As promised I tried this in VB
. I got a different compile error "Declaration Expected". I was able to find very quickly online a valid case for this error (as opposed to the spurious C# error message.) I will remember this in future: if I get an error in C# that makes no sense and is difficult to get help online with, I will try it in VB
and have a different line-of-attack.
Anyway, it alluded to the fact that this code needs to be wrapped in a method - how did I not spot that! Oh well, I won't fall for that one again.
Now I'm getting an issue with the line :
ts = atts(GetType(ToolboxDataAttribute));
I will investigate further and also download your full code for the book; that will probably highlight a fair few issues with my coding so I won't have to keep burdening people with silly requests on this forum.