The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Accessibility Domains and you

0 replies.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a flat view of this topic  Flat View
Previous Topic   Next Topic
Threaded View: This topic has 0 replies on 1 page
Jeff Key

Posts: 481
Nickname: jeffreykey
Registered: Nov, 2003

Jeff Key is legally sane, but questionably competent.
Accessibility Domains and you Posted: Jan 15, 2005 12:54 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jeff Key.
Original Post: Accessibility Domains and you
Feed Title: Jeff Key
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/jkey/Rss.aspx
Feed Description: Topics revolve around .NET and the Windows platform.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jeff Key
Latest Posts From Jeff Key

Sometimes I forget nested type accessibility rules (can containing classes access private members of the nested types?). I recently stumbled upon a nice reference:

C# Language Specs: 3.5.2 Accessibility domains

Included is a great little example at the bottom that serves as a nice quick reference:

In the example

public class A
{
public static int X;
internal static int Y;
private static int Z;
}
internal class B
{
public static int X;
internal static int Y;
private static int Z;

public class C
{
public static int X;
internal static int Y;
private static int Z;
}

private class D
{
public static int X;
internal static int Y;
private static int Z;
}
}

the classes and members have the following accessibility domains:

  • The accessibility domain of A and A.X is unlimited.
  • The accessibility domain of A.Y, B, B.X, B.Y, B.C, B.C.X, and B.C.Y is the program text of the containing program.
  • The accessibility domain of A.Z is the program text of A.
  • The accessibility domain of B.Z and B.D is the program text of B, including the program text of B.C and B.D.
  • The accessibility domain of B.D.X and B.D.Y is the program text of B, including the program text of B.C and B.D.
  • The accessibility domain of B.D.Z is the program text of B.D.

Read: Accessibility Domains and you


Topic: Get an MSN alert whenever this blog updates Previous Topic   Next Topic Topic: Microsoft.SharePoint.Menu

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use