Skip to content

Commit bfc3151

Browse files
[v3] Markdown sub-headings must be parent level incremented by one.
The full specification can be found [here](https://github.com/exercism/docs/blob/main/contributing/standards/markdown.md).
1 parent 4b846ce commit bfc3151

42 files changed

Lines changed: 133 additions & 133 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

concepts/casting/about.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ In C# very often, outside of the realm of numeric values and class hierarchies,
88

99
Note that implicit an explicit cast [operators][operator-overloading] (discussed in (TODO cross-ref-tba)) are available which can bring fairly arbitrary casting to your own types.
1010

11-
#### Casting Primitive Types - Implicit
11+
## Casting Primitive Types - Implicit
1212

1313
C#'s type system is somewhat stricter than _C_'s or Javascript's and as a consequence, casting operations are more restricted. [Implicit casting][implicit-casts] takes place between two numeric types as long as the "to" type can preserve the scale and sign of the "from" type's value. Note in the documentation the exception for converting to real numbers where precision may be lost.
1414

@@ -23,15 +23,15 @@ There is no implicit conversion of a numeric (or string) expression to `bool`. T
2323

2424
An expression of type `char` can be implicitly cast to `int`. The cast in the opposite direction must be explicit. Not all values of `int` are valid utf 16 chars.
2525

26-
#### Casting Primitive Types - Explicit
26+
## Casting Primitive Types - Explicit
2727

2828
Where numeric types cannot be cast implicitly you can generally use the explicit cast [operator][cast-operator].
2929

3030
Where the value being cast cannot be represented by the "to" type because it is insufficiently wide or there is a sign conflict then an overflow exception may be thrown in the case of integers, or the "to" type variable may take a value of `Infinity` in the case of floats and doubles.
3131

3232
An expression of type `int` can be explicitly cast to `char`. This may result in an invalid `char`.
3333

34-
#### Casting Primitive Types - Examples
34+
## Casting Primitive Types - Examples
3535

3636
```csharp
3737
int largeInt = Int32.MaxValue;
@@ -61,7 +61,7 @@ int fromString_bad = Int32.Parse("forty two"); // FormatException is thrown
6161

6262
See this [article][checked] for the _**checked**_ keyword.
6363

64-
#### Type Conversion for types in a hierarchy
64+
## Type Conversion for types in a hierarchy
6565

6666
Any type can be implicitly converted to its base class or interface.
6767

@@ -112,13 +112,13 @@ if (r is Foo foo3)
112112

113113
The [`as`][as-operator] keyword fulfills a similar function to `is` e.g. `var foo = ifoo as Foo;`. In this example `foo` will be `null` if `ifoo` is not of type `Foo` otherwise `ifoo` will be assigned to it.
114114

115-
#### Custom Cast Operator
115+
## Custom Cast Operator
116116

117117
Types can define their own custom explicit and implicit [cast operators][custom-casts]. See (TODO cross-ref-tba) for coverage of this..
118118

119119
Examples of [explicit][big-integer-explicit] and [implicit][big-integer-implicit] casts in the BCL is conversions from the `BigInteger` struct to and from other numeric types
120120

121-
#### Using `typeof`
121+
## Using `typeof`
122122

123123
If you need to detect the precise type of an object then `is` may be a little too permissive as it will convert an object to a class or any of its base classes. `typeof` and `Object.GetType()` are the solution in this case.
124124

concepts/chars/about.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ These rough edges mostly relate to the opposition
1414
between the full unicode standard on the one side and historic representations
1515
of text as well as performance and memory usage on the other.
1616

17-
### Unicode Issues
17+
## Unicode Issues
1818

1919
When dealing with strings, if `System.String` library methods are available you should
2020
seek these out and use them rather than breaking the string down into characters.
@@ -45,15 +45,15 @@ is where you can use `String`'s library methods.
4545
If you do find yourself in the unenviable position of dealing with the minutiae of unicode
4646
then [this][char-encoding-net] is a good starting point.
4747

48-
### Globalization
48+
## Globalization
4949

5050
If you are working in an environment where you are dealing with multiple cultures or
5151
the culture is important in some parts of the code but not others then be
5252
aware of the overloads of [`ToUpper`][to-upper] and [`ToLower`][to-lower] which take a culture and
5353
[`ToUpperInvariant`][to-upper-invariant] and [`ToLowerInvariant`][to-lower-invariant] which will provide a consistent
5454
result irrespective of the current [culture][culture-info].
5555

56-
### Representation, Characters and Integers
56+
## Representation, Characters and Integers
5757

5858
Like other simple types (`int`s, `bool`s, etc.) the `char` has a companion
5959
or alias type, in this case, `System.Char`. This is in fact a `struct` with

concepts/constants/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About
22

3-
#### const
3+
## const
44

55
The [`const`][constants] modifier can be (and generally should be) applied to any field where its value is known at compile time and will not change during the lifetime of the program.
66

@@ -27,7 +27,7 @@ public double Area(double r)
2727

2828
Identifying a value with `const` in this way can be useful if it is used multiple times in the method or you want to draw attention to its meaning. There is no performance gain over using literals inline.
2929

30-
#### readonly
30+
## readonly
3131

3232
The [`readonly`][readonly-fields] modifier can be (and generally should be) applied to any field that cannot be made `const` where its value will not change during the lifetime of the program and is either set by an inline initializer or during instantiation (by the constructor or a method called by the constructor).
3333

concepts/equality/about.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
The coding exercise illustrates a number of properties of equality in C#:
44

5-
### `Object.Equals()`
5+
## `Object.Equals()`
66

7-
#### Topics covered by the coding exercise
7+
### Topics covered by the coding exercise
88

99
- Simple types (strings and primitives) are typically tested for equality with the `==` and `!=`. This is considered more idiomatic than using the [`Equals()`][object-equals] method which is also available with these types. Java programmers should be alert, when dealing with strings, to the fact that `==` compares by value in C# but by reference in Java when returning to their former language.
1010
- Reference types (Instances of classes) are compared using the `Equals()` method inherited from `object`. If your goal with the equality test is to ensure that two objects are the exact same instance then relying on `object`'s implementation will suffice. If not, you need to override `object.Equals()`.
@@ -48,7 +48,7 @@ ReferenceEquals(winA, winC);
4848
// => true
4949
```
5050

51-
#### Ancillary topics
51+
### Ancillary topics
5252

5353
- In addition to `public override bool Equals(object obj)` IDEs typically generate the overload `protected bool Equals(FacialFeatures other)` for use when inheritance is involved. A derived class can call the base classe's `Equals()` and then add its own test.
5454
- Do not use `==` unless you have [overloaded][operator-overloading] the `==` operator, as well as the `Equals()` method in your class (see the `operator-overloading` exercise) or you care only that the references are equal.

concepts/equality/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ An overridden `Equals()` method will contain equality tests on members of simple
1010

1111
The `Object` class provides appropriate methods to compare two objects to detect if they are one and the same instance.
1212

13-
### `Object.GetHashCode()`
13+
## `Object.GetHashCode()`
1414

1515
The `Object.GetHashCode()` method returns a hash code in the form of a 32 bit integer. The hash code is used by _dictionary_ and _set_ classes such as `Dictionary<T>` and `HashSet<T>`to store and retrieve objects in a performant manner.
1616

concepts/integral-numbers/about.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The types discussed so far are _primitive_ types. Each is paired with a `struct`
2121
| `uint` | `UInt32` | 32 bit | 0 | +4_294_967_295 |
2222
| `ulong` | `UInt64` | 64 bit | 0 | +18_446_744_073_709_551_615 |
2323

24-
#### Casting
24+
## Casting
2525

2626
A variable (or expression) of one type can easily be converted to another. For instance, in an assignment operation, if the type of the value being assigned (rhs) ensures that the value will fit within the range of the type being assigned to (lhs) then there is a simple assignment:
2727

@@ -45,13 +45,13 @@ The requirement for casting is determined by the two types involved rather than
4545

4646
The following paragraphs discuss the casting of integral types. (TODO cross-ref-tba casting) provides a broader discussion of casting and type conversion. See that documentation for a discussion of conversion between integral types and floating-point numbers, `char` and `bool`.
4747

48-
##### Casting Primitive Types - Implicit
48+
### Casting Primitive Types - Implicit
4949

5050
C#'s type system is somewhat stricter than _C_'s or Javascript's and as a consequence, casting operations are more restricted. [Implicit casting][implicit-casts] takes place between two numeric types as long as the "to" type can preserve the scale and sign of the "from" type's value.
5151

5252
An implicit cast is not signified by any special syntax.
5353

54-
##### Casting Primitive Types - Explicit
54+
### Casting Primitive Types - Explicit
5555

5656
Where numeric types cannot be cast implicitly you can generally use the explicit cast [operator][cast-operator].
5757

concepts/integral-numbers/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ short s = 42;
3131
uint ui = (uint)s;
3232
```
3333

34-
#### Bit conversion
34+
## Bit conversion
3535

3636
The `BitConverter` class provides a convenient way of converting integer types to and from arrays of bytes.

concepts/interfaces/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ By design, C# does not support multiple inheritance, but it facilitates a kind o
117117

118118
Moreover, the concept of [polymorphism can be implemented through interfaces][interface-polymorphism] underpins the interface mechanism.
119119

120-
#### Explicit interface implementation
120+
## Explicit interface implementation
121121

122122
Sometimes method names and signatures can be shared in two different interfaces.
123123
In order provide a distinct implementation of these methods, C# provides [explicit implementation of interfaces][explicit-implementation]. Note that to use a particular implementation of an interface you need to convert the expression containing referencing the object to that interface. Assignment, casting or passing as a parameter will achieve this.
@@ -166,7 +166,7 @@ There are a number of use cases:
166166
- Methods with the same name but different return types: if you implement your own collection classes you may find that an explicit interface for the legacy `IEnumerable.GetEnumerator()`, alongside `IEnumerable<T>.GetEnuerator()`, is required. You may never make use of such the interface but the compiler may insist.
167167
- Methods where there is no clash of names between interfaces but it is desirable that the implementing class uses the name for some related purpose: `IFormattable` has a `ToString()` method which takes a _format type_ parameter as well as parameter of type `IFormatProvider`. A class like `FormattableString` from the Base Class Library (BCL) has the interface to ensure it can be used by routines that take an `IFormattable` but it is more expressive for its main version of `ToString(IFormatProvider)` to omit the _format type_ parameter as it is not used in the implementation and would confuse API users.
168168

169-
#### Default implementation
169+
## Default implementation
170170

171171
Version 8 of C# addresses a nagging problem with APIs. If you add methods to an interface to enhance functionality for new implementations then it is necessary to modify all the existing implementations of the interface so that they comply with the API-contract even though they have no implementation specific behavior. C# now allows for a _default method_ to be provided as part of the interface (Java developers will be familiar). Previously, when such a change occurred a _version 2_ of the interface would exist alongside the original.
172172

concepts/lists/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A collection definition typically includes a place holder in angle brackets, oft
1313

1414
Unlike arrays (TODO cross-ref-tba) lists can resize themselves dynamically.
1515

16-
#### LINQ
16+
## LINQ
1717

1818
Although the built-in API of `List<T>` is rich (including mappings and filters such as `ConvertAll`, `FindAll` and `Foreach`) and its [looping syntax][for-each] is very clear, and you definitely need to be familiar with this API, Language Integrated Query ([LINQ][linq]) is available for many tasks, is even more powerful and widely used and has the advantage of providing a consistent interface across library collections, third-party collections and your own classes. See (TODO cross-ref-tba).
1919

concepts/namespaces/about.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ According to the [official documentation][namespaces] namespaces have two princi
2222

2323
Namespaces are used widely by the base class library (BCL) to organize its functionality.
2424

25-
#### References to namespaced types
25+
## References to namespaced types
2626

2727
Types enclosed in namespaces are referred to outside the namespace by prefixing the type name with the dot syntax. Alternatively, and more usually, you can place a `using` directive at the top of the file (or within a namespace) and any types in the imported namespace can be used without the prefix. Within the same namespace there is no need to qualify type names.
2828

@@ -68,13 +68,13 @@ This [article][using] clearly explains the ways in which the `using` directive c
6868
- `using static`: avoid having to qualify members with types (a good example is `Math.Max()`).
6969
- `using MyAlias = YourNamespace;`: substitute a more readable name for the namespace name.
7070

71-
#### Clash of namespaces
71+
## Clash of namespaces
7272

7373
.NET addresses the issue of two namespaces with the same name in different assemblies where there would be a clash of fully qualified identifier names (perhaps a scenario where multiple versions of an assembly are loaded). This issue is addressed with the [namespace alias qualifier][namespace-alias-qualifier] and the [extern alias][extern-alias].
7474

7575
One reason to raise this fairly niche topic is because of its use of the [`::` operator][dot-dot-operator]. You will often see the qualifier `global::` prefixing namespaces, particularly in generated code. The intention here is to avoid a potential clash with some nested namespace or class name. By prefixing a namespace with `global::` you ensure that a top-level namespace is selected.
7676

77-
#### Note for Java developers
77+
## Note for Java developers
7878

7979
When comparing with the `import` of Java `packages` some differences and similarities should be noted:
8080

0 commit comments

Comments
 (0)