|
| 1 | +# Contribution Guidelines |
| 2 | + |
| 3 | +You can help by contributing new examples or improve on existing ones that |
| 4 | +demonstrate how to use the various MoreLINQ methods and extensions. |
| 5 | + |
| 6 | +All it takes to add an example is the following fenced-block in a Markdown |
| 7 | +document: |
| 8 | + |
| 9 | + ```c# --destination-file ../code/Program.cs --region statements --project ../code/TryMoreLinq.csproj |
| 10 | + // replace this comment with your example code |
| 11 | + ``` |
| 12 | + |
| 13 | +**You can develop an example as a single C# expression or as C# statements.** |
| 14 | +In the above example, `--region statements` assumes the example code is |
| 15 | +expressed as one or more C# statements: |
| 16 | + |
| 17 | + ```c# --destination-file ../code/Program.cs --region statements --project ../code/TryMoreLinq.csproj |
| 18 | + var xs = Enumerable.Range(1, 5); |
| 19 | + foreach (var x in xs) |
| 20 | + Console.WriteLine(x); |
| 21 | + ``` |
| 22 | + |
| 23 | +To show an example as a single C# expression, instead, change |
| 24 | +`--region statements` to `--region expression`. The benefit is that you do not |
| 25 | +need to worry about looping and displaying the result of the expression via |
| 26 | +`Console.WriteLine`. This will be done automatically when the example is run |
| 27 | +interactively through Try .NET. Following is an example using an expression: |
| 28 | + |
| 29 | + ```c# --destination-file ../code/Program.cs --region expression --project ../code/TryMoreLinq.csproj |
| 30 | + Enumerable.Range(1, 5) |
| 31 | + ``` |
| 32 | + |
| 33 | +Note that expressions _must not_ be terminated by a semi-colon (`;`), which is |
| 34 | +the standard syntax rule in C#. |
| 35 | + |
| 36 | +Keep examples: |
| 37 | + |
| 38 | +- simple |
| 39 | +- clear |
| 40 | +- short |
| 41 | +- meaningful |
| 42 | +- self-contained |
| 43 | + |
| 44 | +**Wrap paragraphs in Markdown documents such that no line exceeds 78 |
| 45 | +characters in length.** See the "Wrap Your Text" section of [Markdown Style |
| 46 | +Guide] on [Miguel de Icaza's Blog][tirania] for the background behind this |
| 47 | +choice. |
| 48 | + |
| 49 | +That's it! Fork away and submit your pull request! |
| 50 | + |
| 51 | + |
| 52 | +[Markdown Style Guide]: https://tirania.org/blog/archive/2014/Sep-30.html |
| 53 | +[tirania]: https://tirania.org/blog/ |
0 commit comments