Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
How to hide System.Object members from your interfaces
travislaborde
follow
0
4-1-2008 7:06 AM
183 views
tags:
programming
,
.net
travislaborde
says:
Beautiful
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Related Clips
ComCast Hears You and Talks Back
Sophia
Harvard Researchers Create Computer Langua...
Creative Code: 14 Ways to Learn From Creat...
FOSSwiki
FreeBookZone - free eBooks
Goodbye To Faulty Software?
More clips from
travislaborde
Talula Does The Hula From Hawaii
Japanese iPhones Get Exclusive Feature to...
Unit Test Boundaries
Today's Top Clips
Hero
Do Not Read This !
Extinguishing the Fear at the Roots of Anxiety
'Last Lecture' professor dies at 47
How Many Silicon Valley Startup Executives Are Hopped Up On Provigil?
Scientists Find the Trigger of the Northern Lights
Thinking Ahead
Unknown insects found in 110-million-year-old amber in Spain
High Speed Photography
Intel: Human and computer intelligence will merge in 40 years
visit the
Top Clips page
View the Top Clips from
April 1, 2008
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://www.clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/004e64c5-9025-483b-87b3-06d29773e177/71386829-591C-4426-BE6C-0C92647191A5/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx" href="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx" style="font-size: 11px;">www.clariusconsulting.net</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><H2>How to hide System.Object members from your interfaces </H2></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><div align="center"><img src="http://content9.clipmarks.com/blog_cache/www.clariusconsulting.net/img/24E9A32E-AC68-4E6D-881B-0F834CB95413" alt="image" /></div></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><P>A much cleaner intellisense is possible though:</P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><div align="center"><img src="http://content6.clipmarks.com/blog_cache/www.clariusconsulting.net/img/8FEDD8BA-D2BC-4984-A9B1-28269D7C1C3E" alt="image" /></div></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><P>The trick comes from the <A href="http://msdn2.microsoft.com/en-us/library/System.ComponentModel.EditorBrowsableAttribute.aspx">System.ComponentModel.EditorBrowsableAttribute</A>, which controls visibility of members in VS intellisense. To hide a member from intellisense, you apply the following attribute to it:</P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><PRE class="code"><SPAN>[</SPAN><SPAN>EditorBrowsable</SPAN><SPAN>(</SPAN><SPAN>EditorBrowsableState</SPAN><SPAN>.</SPAN><SPAN>Never)]</SPAN></PRE></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><PRE class="code"><SPAN> [</SPAN><SPAN>EditorBrowsable</SPAN><SPAN>(</SPAN><SPAN>EditorBrowsableState</SPAN><SPAN>.</SPAN><SPAN>Never)] </SPAN><SPAN>public interface </SPAN><SPAN>IHideObjectMembers </SPAN><SPAN>{ </SPAN><SPAN> </SPAN><SPAN>[</SPAN><SPAN>EditorBrowsable</SPAN><SPAN>(</SPAN><SPAN>EditorBrowsableState</SPAN><SPAN>.</SPAN><SPAN>Never)] </SPAN><SPAN>Type </SPAN><SPAN>GetType(); </SPAN><SPAN> </SPAN><SPAN>[</SPAN><SPAN>EditorBrowsable</SPAN><SPAN>(</SPAN><SPAN>EditorBrowsableState</SPAN><SPAN>.</SPAN><SPAN>Never)] </SPAN><SPAN>int </SPAN><SPAN>GetHashCode(); </SPAN><SPAN> </SPAN><SPAN>[</SPAN><SPAN>EditorBrowsable</SPAN><SPAN>(</SPAN><SPAN>EditorBrowsableState</SPAN><SPAN>.</SPAN><SPAN>Never)] </SPAN><SPAN>string </SPAN><SPAN>ToString(); </SPAN><SPAN> </SPAN><SPAN>[</SPAN><SPAN>EditorBrowsable</SPAN><SPAN>(</SPAN><SPAN>EditorBrowsableState</SPAN><SPAN>.</SPAN><SPAN>Never)] </SPAN><SPAN>bool </SPAN><SPAN>Equals(</SPAN><SPAN>object </SPAN><SPAN>obj); } </SPAN></PRE></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><PRE class="code"><SPAN>public interface </SPAN><SPAN>IVerifies </SPAN><SPAN>: </SPAN><SPAN>IHideObjectMembers</SPAN></PRE></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx"><P>Sometimes I do love VS :)</P></blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/71386829-591C-4426-BE6C-0C92647191A5/blog/" title="blog or email this clip"><img src="http://content7.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Blog
Copyright
Privacy
EULA
OK