Monday, 30 January 2017

ACCESS MODIFIERS FOR TYPES(CLASSES) IN C#

CLASSES, STRUCTURES, INTERFACES, DELEGATES WILL HAVE TYPES AND CAN ONLY USE INTERNAL OR PUBLIC ACCESS MODIFIERS

using System;

namespace ConsoleApplication4
{
    public class AssemblyOne
    {
        public void PrinID()
        {
            Console.WriteLine("print this is a types example");
        }
    }
}

// default  is internal for type classes like classes, structures, interfaces, delegates, etc..

// default  is private for type members like fields, properties, methods, etc 


using System;
using AssemblyOne;

namespace ConsoleApplication4
{
internal class AssemblyTwo 
    {
        AssemblyOne instance = new AssemblyOne();
        instance.xxxxxx     = xyz;
    }
}

No comments:

Post a Comment