Contributors Guide

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search

Your contribution is welcome! In fact, this project depends on you and others to write and edit articles and tutorials and to contribute C# source code for the good of the community of C# programmers and developers. If this is your first contribution, please read the C# Online.NET Contributor Agreement.

Contents

Basic guidelines

  1. First, you must create a user id and login to edit. It is a quick and simple one step process. Then, edit your User page to tell us a little about your background and where you live.
  2. Next, read our Mission Statement.
  3. Here are a few simple guidelines for contributors:
  • Follow existing style where possible.
  • Surround C# code fragments with either <pre></pre> or <CSO_Source></CSO_Source> tags. <CSO_Source> tags perform syntax highlighting similar to that of Visual Studio and allow automatic line numbering.
  • Surround inline C# code and keywords with <code></code> tags.
  • Use MediaWiki markup where possible, for example for Sections and Lists.
  • Please DO NOT use the hash sign (#) in internal MediaWiki links! The link name will be truncated as the # is treated as an end of line character. So, use the word "CSharp" where you would use "C#" in a link name.
  • People are passionate about their coding styles and conventions; but for consistency, please use the following indentation style for all your code snippets:
class ClassName
{ 
   // C# code with indentation of 3 spaces
}
  • For program output, please use the following template:
{{Program output|figure=Sample
|output=Catastrophic program failure!
}}


 Sample (program output)
Catastrophic program failure!
  • External links should be either to the home page or to a major section page and not to an individual article and never within a page (using the # sign).
  • Capitalize only the first word of a headline—unless, of course, it requires capitalization on its own. For example, use:

MSDN references

rather than

MSDN References

  • Do not use amperands (&) in link titles—they do not work correctly in all situations.

Syntax highlighting

<CSO_Source> tags perform syntax highlighting similar to that of Visual Studio and allow automatic line numbering.

Use <CSO_Source>...</CSO_Source> to produce syntax highlighting for C#:

ColorDialog colorDialog = new ColorDialog(); 
if ( colorDialog.ShowDialog() != DialogResult.Cancel ) { 
   textBox.ForeColor = colorDialog.Color;
   }

Do not use line numbering unless you intend to refer to them in the text. To produce line numbers, you must include an option list in square brackets ([[]]). The first item in the option list must be the target language, i.e. csharp. The second option is the starting line number.

<CSO_Source>[[csharp,1]]...</CSO_Source> will produce the following line numbered listing:

  1. ColorDialog colorDialog = new ColorDialog();
  2. if ( colorDialog.ShowDialog() != DialogResult.Cancel ) {
  3. textBox.ForeColor = colorDialog.Color;
  4. }

<CSO_Source>[[csharp,10]]...</CSO_Source> will produce the following line numbered listing beginning with line number 10:

  1. ColorDialog colorDialog = new ColorDialog();
  2. if ( colorDialog.ShowDialog() != DialogResult.Cancel ) {
  3. textBox.ForeColor = colorDialog.Color;
  4. }

Certain line numbers can be highlighted—line number in bold, yellow content—by specifying line numbers in parentheses individually and-or in range pairs. For example, <CSO_Source>[[csharp,10,(11-13)]]...</CSO_Source> will produce the following line numbered listing:

  1. ColorDialog colorDialog = new ColorDialog();
  2. if ( colorDialog.ShowDialog() != DialogResult.Cancel ) {
  3. textBox.ForeColor = colorDialog.Color;
  4. }

Alternatively, <CSO_Source>[[csharp,10,(11,13)]]...</CSO_Source> will produce the following line numbered listing:

  1. ColorDialog colorDialog = new ColorDialog();
  2. if ( colorDialog.ShowDialog() != DialogResult.Cancel ) {
  3. textBox.ForeColor = colorDialog.Color;
  4. }

Use <CSO_Source>[[langlist]]</CSO_Source> to produce a list of supported languages like the following:

Current enabled languages: actionscript, ada, apache, asm, bash, c, cpp, csharp, css, delphi, dos, eiffel, html, ini, java, java5, javascript, js, lisp, matlab, mpasm, objc, oracle8, pascal, perl, php, pseudocode, python, qbasic, ruby, scheme, smarty, sql, vb, vbnet, vhdl, xhtml, xml.

Shortcomings

System class names must be added to a master list by the Wiki sysadmin in order to be syntax colored correctly, e.g. ColorDialog above. If your class names are not on that list, you may request that they be added.

At times, the yellowing of highlighted line numbers seems not to show up correctly in Internet Explorer.

C# versus CSharp

You will notice that we sometimes use the term "CSharp" instead of "C#". Unfortunately, some software cannot handle the sharp sign (#) in certain contexts. For example, this Wiki software cannot handle the sharp sign in internal links. Therefore, we use "CSharp" when necessary. The two terms are synonymous. And, the proper pronunciation of "C#" is "C-sharp".

Contributor Nations

Material contributions have been made by individuals from the following nations:

Unites States of America Austria United Kingdom


See also


Personal tools