public C# with Example



public C# with Example

The public keyword makes a class (including nested classes), property, method or field available to every 
consumer: 
public class Foo() 
{ 
public string SomeProperty { get; set; } 
public class Baz 
{ 
public int Value { get; set; } 
} 
} 
public class Bar() 
{ 
public Bar() 
{ 
var myInstance = new Foo(); 
var someValue = foo.SomeProperty; 
var myNestedInstance = new Foo.Baz(); 
var otherValue = myNestedInstance.Value; 
} 
} 

0 Comment's

Comment Form

Submit Comment