简体   繁体   中英

Import namespaces C# vs. VB

In C# you need a lot of namespaces and in VB not for the same classes from the same namespaces.

C# example:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

VB example:

Import System.Collections.Generic
Import System.Drawing
Import System.Drawing.Printing
Import System.Linq
Import System.Text

Why you need less imports in VB then in C#?

VB projects have Imported Namespaces (Project properties -> References tab) which indicates the default namespaces to Import for each file inside the project. System and a few other namespaces are added to this list by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM