Hi team,
I have a SyntaxEdit and VbParser in a form.
When running the form if I type for example :
Dim X as list(of string)
The object list is not recognized (I have the error : Type List is not defined) So the end used has to add manually a line in my code : Imports System.Collections.Generic
I don't want my user to be bothered with such declarations.
These are standard .Net framework objects. Is it possible to add all of these objects by default as registered assembly ?
For the moment I add them in my code manually. For example : VBParser.Repository.RegisterAssembly("System.dll")
But I'm sure I will forget some additional dll's to be registered. Is there a way to register all default .Net libraries at once ?
Thank you.
Hi Youn,
Please use
if (vbParser1.Repository.Solution.Workspace != null)
vbParser1.Repository.RegisterNamespaces(new string[] { "System.Collections.Generic" }); - this way you will not need to add this namespace to the import section.
I think you didn't get my question.
My question is not about how to register a specificnamespace.
My question is about how to automatically register all .Net default namespaces
System.Collections.Generic is just one example I noticed it has to be explicitly imported. I'm sure it's not the only one.
I have no idea what my end user will use as functions. So I'm expecting your control to behave like visual studio editor. At least for all the standard/default .Net objects, no "import" should be explicitly required.
Is that clear for you ?
Hi Youn,
Visual Studio does not register all namespaces; the default list is configurable via Project Settings - > References - > Imported Namespaces.
Yes, we can add method like RegisterDefaultNamespaces or something like that, so it register the same namespaces Visual Studio does. Right now you can do the same from code like one I've posted above.