C# Access Modifiers

Access Modifiers are keywords that define the accessibility of a member, class or datatype in a program. These are mainly used to restrict unwanted data manipulation by external programs or classes. There are 4 access modifiers (public, protected, internal, private) which defines the 6 accessibility levels as follows:



  • public
  • protected
  • internal
  • protected internal
  • private
  • private protected



The Accessibility table of these modifiers is given below:

public 
protected 
internal 
protected internal 
private 
private protected 
Entire program 
Yes 
No 
No 
No 
No 
No 
Containing class 
Yes 
Yes 
Yes 
Yes 
Yes 
Yes 
Current assembly 
Yes 
No 
Yes 
Yes 
No 
No 
Derived types 
Yes 
Yes 
No 
Yes 
No 
No 
Derived types within current assembly 
Yes 
Yes 
No 
Yes 
No 
Yes 

Post-Mortem: Using the Repository Pattern With Entity Framework

Dear all future developers who may get stuck dealing with a couple of applications I’ve written over the past year or so.  I know that much future cursing at me is on the way.  Much to my regret, I confess I used repositories with Entity Framework Code-First.


…and I didn’t just use one or two,  I added at least four or five — on top of a BASE repository.  To make it worse, I even created a BaseController to deal with all this so that now I have inheriting controllers that have to deal with ramifications. 


The severity of the above could have been significantly reduced if I had written proper unit tests.  In one app, I actually DID write (improper — with very little mocking) unit tests first but because the tests now need to run on an independent build server, I have to suffer to re-write them quickly to meet a deadline but, the reality is, the apps need re-architecture.   


I’m working on a prototype with better architecture  but that will probably not have time to go through the the whole integration testings, etc. 


Thanks @hoagieland for your post.  It might be a little extreme but with many valid points.


All who have to deal with this particular flavor should read:


You’re All Doing Entity Framework Wrong

.NET Framework vs .NET Core vs .NET Standard ?!?

I think get a grip on the latest trends only to learn that I’m still steps behind.  Thanks to Immo Landwerth for this clear article and cool tricks.  It’s ten months old but new to me.  😑

.NET Standard – Demystifying .NET Core and .NET Standard

“NET Standard is a specification. Each .NET Standard version defines the set of APIs that all .NET implementations must provide to conform to that version. You can think of it as yet-another .NET stack, except that you can’t build apps for it, only libraries. It’s the .NET implementation you should use for libraries that you want to reference from everywhere.”

Descriptions of .NET
Implementations
OS
Open Source
Purpose
.NET Framework
Windows
No
Used for building Windows desktop
applications
and ASP.NET Web apps running on IIS.
.NET Core
Windows, Linux, macOS
Yes
Used for building cross-platform console
apps
and ASP.NET Core Web apps and cloud
services.
Xamarin
iOS, Android, macOS
Yes
Used for building mobile applications for
iOS
and Android, as well as desktop apps for
macOS.
.NET Standard
N/A
Yes
Used for building libraries that can be
referenced
from all .NET implementations, such as
.NET Framework, .NET Core and Xamarin.

Visual Studio Version History With Toolset Paths

Product name Codename Version Number Supported .NET Frameworks Supported .NET / CORE Versions Release date
Visual Studio 97 Boston 5 N/A N/A Feb-97
Visual Studio 6.0 Aspen 6 N/A N/A Jun-98
Visual Studio 2002 Rainier 7 1 N/A 13-Feb-02
Visual Studio 2003 Everett 7.1 1.1 N/A 24-Apr-03
Visual Studio 2005 Whidbey 8 2.0, 3.0 N/A 7-Nov-05
Visual Studio 2008 Orcas 9 2.0, 3.0, 3.5 N/A 19-Nov-07
Visual Studio 2010 Dev10, Rosario 10 2.0 – 4.0 N/A 12-Apr-10
Visual Studio 2012 Dev11 11 2.0 – 4.5.2 N/A 12-Sep-12
Visual Studio 2013 Dev12 12 2.0 – 4.5.2 N/A 17-Oct-13
Visual Studio 2015 Dev14 14 2.0 – 4.6 1 20-Jul-15
Visual Studio 2017 Dev15 15 3.5 – 4.7 1.0-1.1, 2.0 7-Mar-17
Visual Studio 2019 Unknown 16 TBA TBA TBA

Product name .NET Toolset Path
Visual Studio 2005   Windows installation pathMicrosoft.NetFrameworkv2.0.50727
Visual Studio 2008 .NET 3.5 Windows installation pathMicrosoft.NETFrameworkv3.5
Visual Studio 2010 .NET 4.0 Windows installation pathMicrosoft.NETFrameworkv4.0.30319
Visual Studio 2012 .NET 4.5 Windows installation pathMicrosoft.NETFrameworkv4.0.30319
Visual Studio 2013 .NET 4.5.1 %ProgramFiles%MSBuild12.0bin
Visual Studio 2015 14 %ProgramFiles%MSBuild14.0bin
Visual Studio 2017 15 %ProgramFiles%MSBuild15.0bin
Visual Studio 2019 TBA TBA