HI ,
What is inner and nested class in c#?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted May 12, 2013, 1:26 AM EDT
http://www.codeproject.com/Articles/20628/A-Tutorial-on-Nested-Classes-in-C
VulpesRank #55 · 29.2K reputationPosted May 12, 2013, 5:10 AM EDT
'Type' for this purpose means either a class or a struct.
Structs can also be nested or top level as defined above.
Jignesh TrivediRank #16 · 50.3K reputationPosted May 12, 2013, 8:07 PM EDT
Nested classes are nothing but class with in class or we can say the class declaration is fully contained with the other class declaration.
example
public class baseClass
{
// This is the nested class
private class NestedClass
{
// implement NestedClass.
}
//Declare property/ method of base class.
}
Inner class are private and tightly bind or couple with their parent class.
hope this will help you.
Ajitender VijayRank #6,843 · 255 reputationPosted May 12, 2013, 8:49 PM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted May 12, 2013, 9:12 PM EDT
hi,
Whenever i need encapsulate a format of data that is primarily going to be used within the parent class at this time i proffered to use inner or nested class.
also there are several other reason in architecture design to used nested classes.
1) for Logically grouping
2) increases encapsulation level.
3)it is more readable and maintainable code.
hope this will help you.