惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
T
Tenable Blog
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
C
Cyber Attacks, Cyber Crime and Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
H
Help Net Security
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
S
Schneier on Security
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
S
Secure Thoughts
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recorded Future
Recorded Future
C
Cybersecurity and Infrastructure Security Agency CISA
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
博客园 - Franky
T
Tor Project blog
G
GRAHAM CLULEY
博客园 - 【当耐特】
Jina AI
Jina AI
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 蔡秋心

Windows Azure VM的两种shut down 方式 转贴: A Simple c# Wrapper for ffMpeg PowerShell: 找到一个目录下最新的文件 PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get- help about_sig" for more de 在localhost上使用fiddler 在SQL Server Business Intelligence Development Studio中编辑Dynamcis CRM中的Report Report Design: Best Practices and Guidelines Visual Studio使用小技巧5 – 区块选择(box selection)的拷贝(copy)和粘贴(paste) Visual Studio使用小技巧4 – Where am I(在Solution Explorer中显示当前文档) Visual Studio使用小技巧3 – 标签分组(Tab Group)和分割窗口(Split window) Visual Studio使用小技巧2 – 使用任务列表(task list) - 补充 Visual Studio使用小技巧2 – 使用任务列表(task list) Visual Studio使用小技巧1 – HTML编辑器中的格式化 部署Dotnetnuke Site到虚拟目录和端口不为80的网站 asp.net使用COM组件需要的权限设置 前台线程(Foreground Threads)和后台线程(Background Threads) 在Dynamics CRM 的 Entity Form中显示记录的ID的方法 如何使用VS2005创建web安装包 使用Visual Studio中的Item Template
Visual Studio使用小技巧6 – 为代码加上Using(Resolve using)和管理Using(Organize using)
蔡秋心 · 2011-04-04 · via 博客园 - 蔡秋心

* 为代码加上Using(Resolve Using)

是否你遇到过这种情况? 在internet上或者msdn上找到段代码,拷贝到Visual Studio中进行编译;或者是将书上的代码敲入Visual Studio中,进行编译。得到这样的错误:

The type or namespace name '****' could not be found (are you missing a using directive or an assembly reference?)   

这次错误由两个可能的原因引起的。

1。没有添加引用

2。没有using类所在的命名空间(namespace).

前者没有更方便的办法,只能找到类所在的Assembly,并添加对它的引用。后者有很方便的方法: 将光标置于出错的代码上,敲击Control+’.’ .

image

就会弹出像上图的菜单。菜单中的第一项就是添加using System.IO; 后面两个就是用类的全称(命名空间.类)来替换生成错误的类,这样就不需要using了。

错误的类上的鼠标的右键菜单上已有同样的命令:

image

* 管理Using(Organize Using)

在代码窗口上的空白的任何地方,或者是using namespace上,点击鼠标右键,弹出的快捷菜单中,有Organize Using的弹出菜单。下面有几个命令,可能帮助我们管理using

Remove Unused Using: 删除没有使用的Using

Sort Usings: 给Using 排序

Remove and Using: 删除没有使用的Using,然后排序。

 image
这个功能在复制整个类,再进行修改的场合下很有用。