Quantcast
Channel: 2,000 Things You Should Know About C# » Nested Types
Browsing all 5 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

#623 – Defining One Type Inside Another Type

You can define one type within the scope of  another one.  This is known as nesting.  The inner type can have a different accessibility level than the outer type, so it may or may not be visible from...

View Article



Image may be NSFW.
Clik here to view.

#625 – Reference a Nested Type Using Dot Notation

If a nested type is declared with the proper access modifier, it will be accessible from outside the class that contains it.  To use a nested type, you use a dot notation that looks like the following:...

View Article

Image may be NSFW.
Clik here to view.

#627 – Accessibility of Nested Types in a struct or a class

When you define a type within the scope of a class (a nested type), the accessibility of the nested type can be one of the following public protected internal protected internal private  (default) When...

View Article

Image may be NSFW.
Clik here to view.

#628 – Why You Might Create a Nested Type

The most common reasons for creating a nested type–one type defined within another one–are: For information hiding purposes, so only the outer type has access to the type being defined As a way of...

View Article

Image may be NSFW.
Clik here to view.

#629 – Nested Types Have Full Access to Members in Parent

When you declare a nested type, the inner type has access to everything in the parent type, even if the items in the parent are declared as private or protected. public class Dog { public string Name {...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images