-
Notifications
You must be signed in to change notification settings - Fork 63
Coding Style
This page lists preferred coding in this project. These styles are no hard and solid rules but should generally be applied on new contributions to make the code readable for everyone interested.
A coding style is only acceptable, if it is applicable in .Net version 4.5.2 or earlier and can be implemented below < C# version 7.
The project ICSharpCode.AvalonEdit is a feature added fork from icsharpcode/AvalonEdit.
This project should not be changed for coding styles unless you are fixing a critical bug or adding a feature. This project originates mainly from https://github.com/icsharpcode/AvalonEdit and should be updateable/merged with future developments from the original repo at a later point in time.
public int MyField
{
get { return _MyField; }
set { _MyField = value; }
}
public int MyField{ get => _MyField; set => _MyField = value; }
Please use the C# Version 6.0 style in this project.
The names of properties should start with upper case and can contain CamelCase Naming convention:
public int MyField{ get => _MyField; set => _MyField = value; }
A backing private field that is used in a property should have the same name but start with an underscore letter '_'.
The this keyword should be used only in exceptional cases. For example, when it is necessary to distinguish this from base, and so forth.
if (_ActiveDocument is MiniUmlViewModel vm)
{
return vm.DocumentMiniUML as MiniUML.Model.ViewModels.Document.AbstractDocumentViewModel;
}
if (_ActiveDocument is MiniUmlViewModel)
{
MiniUmlViewModel vm = _ActiveDocument as MiniUmlViewModel;
// would be best to wrap a null if check here to ensure as was able to cast
return vm.DocumentMiniUML as MiniUML.Model.ViewModels.Document.AbstractDocumentViewModel;
}
More Details: https://github.com/Dirkster99/Edi/issues/22
The following Visual Studio settings for Tabs & Spaces are preferred:
- Indenting: Smart
- Tab Size: 4
- Indent Size: 4
- Insert Spaces (checked)
The using statements in this projects are generally used inside namespace not in front of a namespace. The recommended style is this:
namespace Edi.Apps.Behaviors
{
using System.Windows.Input;
using System.Windows;
public static class ActivatedCommand
{
}
}
formating code like this has advantages in larger projects like this.