Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
public //visible to anything.
protected //visible to current class and to derived classes.
internal //visible to anything inside the same assembly (.dll/.exe).
protected internal //visible to anything inside the same assembly and also to derived classes outside the assembly.
private //visible only to the current class.
//C# 7.2 adds:
private protected //visible to current class and to derived classes inside the same assembly.
// | | subclass | other class || subclass | other class
//Modifier | class | in same assembly | in same assembly || outside assembly | outside assembly
//-------------------------------------------------------------------------------------------------------
//public | Yes | Yes | Yes || Yes | Yes
//protected internal | Yes | Yes | Yes || Yes | No
//protected | Yes | Yes | No || Yes | No
//internal | Yes | Yes | Yes || No | No
//private | Yes | No | No || No | No
// C# 7.2:
//private protected | Yes | Yes | No || No | No

View file

@ -0,0 +1,21 @@
public interface IPrinter
{
void Print();
}
public class IntPrinter : IPrinter
{
void IPrinter.Print() { // explicit implementation
Console.WriteLine(123);
}
public static void Main() {
//====Error====
IntPrinter p = new IntPrinter();
p.Print();
//====Valid====
IPrinter p = new IntPrinter();
p.Print();
}
}