Re: Miscellaneous questions about converting VO code to X#
Posted: Tue Apr 22, 2025 12:28 pm
Hi Kees,
It's mostly about better organizing/structuring the code and avoiding conflicts. In .Net there are probably millions of classes available to use, and without using different namespaces for them, there would certainly be a lot of classes with the exact same name. If you want to not use a namespace at all for your classes this is fine, but it will make it very difficult for others to use a library of yours, if you care about this.
Another thing that namespaces help with, is intellisense support, as you can group together classes that have common functionality. For example you can use a namespace like DbfStuff for all your classes that deal with databases and you do not need to remember the names of related classes, you can just type "DbfStuff." in the editor, and intellisense will show you a list of all related classes that you may want to use. If you create proper namespaces for grouping, this can be very helpful if you have a lot of classes in your code.
It's mostly about better organizing/structuring the code and avoiding conflicts. In .Net there are probably millions of classes available to use, and without using different namespaces for them, there would certainly be a lot of classes with the exact same name. If you want to not use a namespace at all for your classes this is fine, but it will make it very difficult for others to use a library of yours, if you care about this.
Another thing that namespaces help with, is intellisense support, as you can group together classes that have common functionality. For example you can use a namespace like DbfStuff for all your classes that deal with databases and you do not need to remember the names of related classes, you can just type "DbfStuff." in the editor, and intellisense will show you a list of all related classes that you may want to use. If you create proper namespaces for grouping, this can be very helpful if you have a lot of classes in your code.