PDA

Click to See Complete Forum and Search --> : All internal classes


steve65
Sep 18th, 2005, 04:46 PM
I have a project that I am working on that I do not intend to have any of the methods available outside of the project and so I was going to set all of my classes to internal.

Class1 would be my main program and Class2 to ... Classx will contain all of my methods broken up by functionallity.

Is there a reason as to why you would not want to have a project setup like this:using System;
using System.Windows.Forms;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
internal class Class1
{
internal Class1()
{
//
// TODO: Add constructor logic here
//
}

internal static void Main()
{
Class2.testmthd();
}
}
}and this:using System;
using System.Windows.Forms;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Class2.
/// </summary>
internal class Class2
{
internal Class2()
{
//
// TODO: Add constructor logic here
//
}

internal static void testmthd()
{
MessageBox.Show("This is a test");
}
}
}

Mike Hildner
Sep 18th, 2005, 05:07 PM
FWIW, I don't think there's anything wrong with this, as long as you realize what the internal accessability level does (limits scope to the current assembly).

Mike