Recently, I came across a silly issue where I was not able to see my newly created class in IntelliSense of Visual Studio. After starting from scratch, it came to my notice that by default, Visual Studio creates class without Access Specifiers. This is the reason it became private and it didn't show up in IntelliSense.
Well! You can fix it. Here is how. When you try creating a new class, it uses the template located under the following path:
- %systemdrive%Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class
You should see the file named as class.cs. This file has content, as shown below.
- using System;
- using System.Collections.Generic;
- $if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
- $endif$using System.Text;
- $if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
- $endif$
- namespace $rootnamespace$
- {
- class $safeitemrootname$
- {
- }
- }
Here, change the class definition by adding Public Access Specifier and save/override the file.
- public class $safeitemrootname$
You are good to go. Please leave your comments for any question or concern. Please note that all my articles and posts are open for suggestion(s) or correction(s).