---
title: "Visual Studio 2008 每日提示(二十二)"
author: "cjc"
date: "2009-01-06T00:59:00Z"
tags: []
slug: "visual-studio-2008"
draft: false
lastmod: "2009-01-06T00:59:00Z"
id: 402665
url: "https://cjc.iteye.com/blog/402665"
---

&lt;script&gt;function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}&lt;/script&gt;

本篇包括tip211-tip220  
[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-22.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-22.html)

## #211、在对象浏览器向前和向后导航

原文链接：[The Object Browser has a navigate forward and navigate back](http://blogs.msdn.com/saraford/archive/2008/05/08/did-you-know-the-object-browser-has-a-navigate-forward-and-navigate-back-211.aspx)

**操作步骤：**  
在对象浏览器的工具栏有向前和向后导航的按钮  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowTheObjectBrowserhasanavigatefo_134B6/ObjectBrowserForwardAndBackNavigation_thumb.jpg)

或者使用快捷键**Alt+-（减号）**向后导航和快捷键**Shift+Alt+-（减号）**向前导航。

**评论：按惯例作者会在本篇介绍有关导航的快捷方式。**

## #212、为“从对象浏览器添加引用到解决方案”创建快捷键

原文链接：[You can create a keyboard shortcut for adding references to a solution from the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/09/did-you-know-you-can-create-a-keyboard-shortcut-for-adding-references-to-a-solution-from-the-object-browser-211.aspx)

**操作步骤：**  
菜单：**工具+选项+环境+键盘**，在“**显示命令包含**”文本框输入命令：**对象浏览器添加引用**，然后指定快捷键，比如：**Ctrl+Alt+Shift+T**  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucancreateakeyboardshortcutf_13B2F/ObjectBrowserAddReference3_thumb_2.jpg)

当选中某个组件后（比如Accessibility ），按下快捷键，就会看见如下消息

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucancreateakeyboardshortcutf_13B2F/ObjectBrowserAddReference4_thumb.jpg)

**评论：感觉作者对快捷的操作非常在意。**

## #213、在对象浏览器自定义对象窗格和成员窗格

原文链接：[You can customize both your object pane and members pane in the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/12/did-you-know-you-can-customize-both-your-object-pane-and-members-pane-in-the-object-browser-213.aspx)

**操作步骤：**  
在对象浏览的工具栏，有个“**对象浏览器设置**”下拉按钮，其中的“**查看命名空间**”和“**查看容器** ”选项,这两个选项只能选中一个。

如果你选中“**查看命名空间**”选项，所有的组件将基于他们的**命名空间**显示，在多个物理容器的命名空间将会合并，如下图所示  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucancustomizebothyourobjectp_D0CE/image_thumb.png)

如果选中“**查看容器** ”选项，可以看到物理容器，而分割命名空间包含在里面。如下图所示  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucancustomizebothyourobjectp_D0CE/ObjectBrowserSettings3_thumb.jpg)

**评论：和作者一样，我喜欢后一种方式查看，这样看起来比较清晰。**

## #214、选择是否显示基类

原文链接:[You can choose whether to show base types in the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/13/did-you-know-you-can-choose-whether-to-show-base-types-in-the-object-browser-214.aspx)

**操作步骤：**  
在**对象浏览器设置**（下拉按钮）有个“**显示基类**”的选项  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanchoosewhethertoshowbaset_D5DE/ObjectBrowserShowBaseType1_thumb.jpg)

在下面的例子中，Class1 继承ClassBase，如果选中“**显示基类**”项，就可以看到“基类”的文件夹。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanchoosewhethertoshowbaset_D5DE/ObjectBrowserShowBaseType2_thumb.jpg)

**评论：我一般设置显示基类，这样看起来层次更清楚一些。**

## #215、在对象浏览器显示或隐藏“隐藏类型和成员”

原文链接:[You can hide or show hidden members and types in the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/14/did-you-know-you-can-hide-or-show-hidden-members-and-types-in-the-object-browser-215.aspx)

**操作步骤：**  
在**对象浏览器设置**（下拉按钮）有个“**显示隐藏类型和成员**”的选项。  
启用该选项任何隐藏类型和成员都会被显示出来，不过显示的是灰色状态，如下面例子中的foo()类。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanhideorshowhiddenmembersa_EC73/ObjectBrowserShowHidden2_thumb.jpg)

**评论：我个人觉得，显示出来似乎内容太多了。**

## #216、标记隐藏方法或类型，它们将不会在智能提示和对象浏览器出现

原文链接:[You can mark methods and types as Hidden, so they don’t appear in Intellisense or in the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/15/did-you-know-you-can-mark-methods-and-types-as-hidden-so-they-don-t-appear-in-intellisense-or-in-the-object-browser-216.aspx)

**操作步骤：**  
在上一篇的例子中有 foo() 和 bar() 两个方法，其中foo() 是隐藏方法，它不会在智能提示和对象浏览器中显示。当然，你仍然可以在下面完成foo()方法，并可编译成功。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanmarkmethodsandtypesasHid_F24A/ObjectBrowserEditorBrowsable_thumb.jpg)

**评论：本篇是上一篇的延续。**

## #217、在对象浏览器查看其它成员

原文链接:[What consists of “other” in Show Other Members in Object Browser Settings](http://blogs.msdn.com/saraford/archive/2008/05/16/did-you-know-what-consists-of-other-in-show-other-members-in-object-browser-settings-217.aspx)

**操作步骤：**  
**其他成员**是不属于公共、受保护、私有或继承类别的成员。比如Visual Basic 中Friend型的成员，c#中internal型的成员。如果要显示其他成员，则必须在对象浏览器设置中选中“**显示其他成员**”项。

**评论：默认该项是选中状态。**

## #218、在对象浏览器成员窗格不显示所有的继承成员

原文链接:[How to stop displaying all inherited members in the Object Browser member pane](http://blogs.msdn.com/saraford/archive/2008/05/19/did-you-know-how-to-stop-displaying-all-inherited-members-in-the-object-browser-member-pane-218.aspx)

**操作步骤：**  
选中对象浏览器中的“**显示继承成员**”的项，  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowHowtostopdisplayingallinherite_F9D6/ObjectBrowserShowInheritedMembers_thumb.jpg)

可以显示所有的继承成员，包括从System.Object继承的成员。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowHowtostopdisplayingallinherite_F9D6/ObjectBrowserInheritedMembers_thumb.jpg)

如果不选中的话，就只看到一个很短的清单了。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowHowtostopdisplayingallinherite_F9D6/ObjectBrowserInheritedMembers2_thumb.jpg)

**评论：默认是不选中的，其实如果不需要的话没必要把继承成员都显示。**

## #219、在对象浏览器显示扩展成员

原文链接:[You can show Extension Methods in the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/20/did-you-know-you-can-show-extension-methods-in-the-object-browser-219.aspx)

**操作步骤：**  
在对象浏览器设置中选中“**显示扩展成员**”项

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanshowExtensionMethodsinth_13E4C/ObjectBrowserShowExtensionMembers_thumb.jpg)

将会成员窗格显示扩展成员。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanshowExtensionMethodsinth_13E4C/ObjectBrowserExtensionMethods_thumb.jpg)

**评论：作者把对象浏览器设置的每个选项都讲述了一番，真够细致的。**

## #220、在对象浏览器中两种查找对象的手段（方法）

原文链接:[There are two primary means of searching for objects in the Object Browser](http://blogs.msdn.com/saraford/archive/2008/05/21/did-you-know-there-are-two-primary-means-of-searching-for-objects-in-the-object-browser-220.aspx)

**操作步骤：**  
1、通过对象浏览器的搜索框来查找对象，搜索框位于对象浏览器的第二工具栏。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowTherearetwoprimarymeansofsearc_E622/ObjectBrowserSearch1_thumb.jpg)

2、通过“**查找和替换**”对话框中的“**查找符号**”来查找对象。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowTherearetwoprimarymeansofsearc_E622/ObjectBrowserSearch3_thumb.jpg)

你会发现这种方法和在对象浏览器中搜索非常类似。

**评论：其实第二种方法和第一种方法本质上是一个方法，只是查找的窗口不同罢了。**

更多文章见：守望轩\[[http://www.watch-life.net/](http://www.watch-life.net/)]