Skip to content

Commit e2892fb

Browse files
authored
revert changes to design guidelines (#46447)
1 parent a22588d commit e2892fb

9 files changed

+18
-18
lines changed

docs/standard/design-guidelines/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ helpviewer_keywords:
1818

1919
✔️ CONSIDER using jagged arrays instead of multidimensional arrays.
2020

21-
A jagged array is an array with elements that are also arrays. The arrays that make up the elements can be of different sizes, leading to less wasted space for some sets of data (for example, sparse matrix) compared to multidimensional arrays. Furthermore, the CLR optimizes index operations on jagged arrays, so they might exhibit better runtime performance in some scenarios.
21+
A jagged array is an array with elements that are also arrays. The arrays that make up the elements can be of different sizes, leading to less wasted space for some sets of data (e.g., sparse matrix) compared to multidimensional arrays. Furthermore, the CLR optimizes index operations on jagged arrays, so they might exhibit better runtime performance in some scenarios.
2222

2323
*Portions © 2005, 2009 Microsoft Corporation. All rights reserved.*
2424

docs/standard/design-guidelines/dependency-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.assetid: 212cfb1e-cec4-4047-94a6-47209b387f6f
1010

1111
A dependency property (DP) is a regular property that stores its value in a property store instead of storing it in a type variable (field), for example.
1212

13-
An attached dependency property is a kind of dependency property modeled as static Get and Set methods representing "properties" describing relationships between objects and their containers (for example, the position of a `Button` object on a `Panel` container).
13+
An attached dependency property is a kind of dependency property modeled as static Get and Set methods representing "properties" describing relationships between objects and their containers (e.g., the position of a `Button` object on a `Panel` container).
1414

1515
✔️ DO provide the dependency properties, if you need the properties to support WPF features such as styling, triggers, data binding, animations, dynamic resources, and inheritance.
1616

docs/standard/design-guidelines/dispose-pattern.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ All programs acquire one or more system resources, such as memory, system handle
2626

2727
Although finalizers are effective in some cleanup scenarios, they have two significant drawbacks:
2828

29-
- The finalizer is called when the GC detects that an object is eligible for collection. This happens at some undetermined period of time after the resource is not needed anymore. The delay between when the developer could or would like to release the resource and the time when the resource is actually released by the finalizer might be unacceptable in programs that acquire many scarce resources (resources that can be easily exhausted) or in cases in which resources are costly to keep in use (for example, large unmanaged memory buffers).
29+
- The finalizer is called when the GC detects that an object is eligible for collection. This happens at some undetermined period of time after the resource is not needed anymore. The delay between when the developer could or would like to release the resource and the time when the resource is actually released by the finalizer might be unacceptable in programs that acquire many scarce resources (resources that can be easily exhausted) or in cases in which resources are costly to keep in use (e.g., large unmanaged memory buffers).
3030

3131
- When the CLR needs to call a finalizer, it must postpone collection of the object’s memory until the next round of garbage collection (the finalizers run between collections). This means that the object’s memory (and all objects it refers to) will not be released for a longer period of time.
3232

@@ -78,7 +78,7 @@ public class DisposableResourceHolder : IDisposable {
7878
}
7979
```
8080

81-
The Boolean parameter `disposing` indicates whether the method was invoked from the `IDisposable.Dispose` implementation or from the finalizer. The `Dispose(bool)` implementation should check the parameter before accessing other reference objects (for example, the resource field in the preceding sample). Such objects should only be accessed when the method is called from the `IDisposable.Dispose` implementation (when the `disposing` parameter is equal to true). If the method is invoked from the finalizer (`disposing` is false), other objects should not be accessed. The reason is that objects are finalized in an unpredictable order and so they, or any of their dependencies, might already have been finalized.
81+
The Boolean parameter `disposing` indicates whether the method was invoked from the `IDisposable.Dispose` implementation or from the finalizer. The `Dispose(bool)` implementation should check the parameter before accessing other reference objects (e.g., the resource field in the preceding sample). Such objects should only be accessed when the method is called from the `IDisposable.Dispose` implementation (when the `disposing` parameter is equal to true). If the method is invoked from the finalizer (`disposing` is false), other objects should not be accessed. The reason is that objects are finalized in an unpredictable order and so they, or any of their dependencies, might already have been finalized.
8282

8383
Also, this section applies to classes with a base that does not already implement the Dispose Pattern. If you are inheriting from a class that already implements the pattern, simply override the `Dispose(bool)` method to provide additional resource cleanup logic.
8484

docs/standard/design-guidelines/extension-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Extension methods are a language feature that allows static methods to be called
3636

3737
❌ DO NOT define extension methods implementing a feature in namespaces normally associated with other features. Instead, define them in the namespace associated with the feature they belong to.
3838

39-
❌ AVOID generic naming of namespaces dedicated to extension methods (for example, "Extensions"). Use a descriptive name (for example, "Routing") instead.
39+
❌ AVOID generic naming of namespaces dedicated to extension methods (e.g., "Extensions"). Use a descriptive name (e.g., "Routing") instead.
4040

4141
*Portions © 2005, 2009 Microsoft Corporation. All rights reserved.*
4242

docs/standard/design-guidelines/guidelines-for-collections.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Any type designed specifically to manipulate a group of objects having some comm
4444

4545
✔️ DO use `Collection<T>` or a subclass of `Collection<T>` for properties or return values representing read/write collections.
4646

47-
If `Collection<T>` does not meet some requirement (for example, the collection must not implement <xref:System.Collections.IList>), use a custom collection by implementing `IEnumerable<T>`, `ICollection<T>`, or <xref:System.Collections.Generic.IList%601>.
47+
If `Collection<T>` does not meet some requirement (e.g., the collection must not implement <xref:System.Collections.IList>), use a custom collection by implementing `IEnumerable<T>`, `ICollection<T>`, or <xref:System.Collections.Generic.IList%601>.
4848

4949
✔️ DO use <xref:System.Collections.ObjectModel.ReadOnlyCollection%601>, a subclass of `ReadOnlyCollection<T>`, or in rare cases `IEnumerable<T>` for properties or return values representing read-only collections.
5050

51-
In general, prefer `ReadOnlyCollection<T>`. If it does not meet some requirement (for example, the collection must not implement `IList`), use a custom collection by implementing `IEnumerable<T>`, `ICollection<T>`, or `IList<T>`. If you do implement a custom read-only collection, implement `ICollection<T>.IsReadOnly` to return `true`.
51+
In general, prefer `ReadOnlyCollection<T>`. If it does not meet some requirement (e.g., the collection must not implement `IList`), use a custom collection by implementing `IEnumerable<T>`, `ICollection<T>`, or `IList<T>`. If you do implement a custom read-only collection, implement `ICollection<T>.IsReadOnly` to return `true`.
5252

5353
In cases where you are sure that the only scenario you will ever want to support is forward-only iteration, you can simply use `IEnumerable<T>`.
5454

@@ -78,7 +78,7 @@ Any type designed specifically to manipulate a group of objects having some comm
7878

7979
✔️ DO use either a snapshot collection or a live `IEnumerable<T>` (or its subtype) to represent collections that are volatile (i.e., that can change without explicitly modifying the collection).
8080

81-
In general, all collections representing a shared resource (for example, files in a directory) are volatile. Such collections are very difficult or impossible to implement as live collections unless the implementation is simply a forward-only enumerator.
81+
In general, all collections representing a shared resource (e.g., files in a directory) are volatile. Such collections are very difficult or impossible to implement as live collections unless the implementation is simply a forward-only enumerator.
8282

8383
## Choosing Between Arrays and Collections
8484

@@ -92,7 +92,7 @@ Any type designed specifically to manipulate a group of objects having some comm
9292

9393
✔️ DO use byte arrays instead of collections of bytes.
9494

95-
❌ DO NOT use arrays for properties if the property would have to return a new array (for example, a copy of an internal array) every time the property getter is called.
95+
❌ DO NOT use arrays for properties if the property would have to return a new array (e.g., a copy of an internal array) every time the property getter is called.
9696

9797
## Implementing Custom Collections
9898

@@ -110,7 +110,7 @@ Any type designed specifically to manipulate a group of objects having some comm
110110

111111
### Naming Custom Collections
112112

113-
Collections (types that implement `IEnumerable`) are created mainly for two reasons: (1) to create a new data structure with structure-specific operations and often different performance characteristics than existing data structures (for example, <xref:System.Collections.Generic.List%601>, <xref:System.Collections.Generic.LinkedList%601>, <xref:System.Collections.Generic.Stack%601>), and (2) to create a specialized collection for holding a specific set of items (for example, <xref:System.Collections.Specialized.StringCollection>). Data structures are most often used in the internal implementation of applications and libraries. Specialized collections are mainly to be exposed in APIs (as property and parameter types).
113+
Collections (types that implement `IEnumerable`) are created mainly for two reasons: (1) to create a new data structure with structure-specific operations and often different performance characteristics than existing data structures (e.g., <xref:System.Collections.Generic.List%601>, <xref:System.Collections.Generic.LinkedList%601>, <xref:System.Collections.Generic.Stack%601>), and (2) to create a specialized collection for holding a specific set of items (e.g., <xref:System.Collections.Specialized.StringCollection>). Data structures are most often used in the internal implementation of applications and libraries. Specialized collections are mainly to be exposed in APIs (as property and parameter types).
114114

115115
✔️ DO use the "Dictionary" suffix in names of abstractions implementing `IDictionary` or `IDictionary<TKey,TValue>`.
116116

docs/standard/design-guidelines/names-of-classes-structs-and-interfaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The naming guidelines that follow apply to general type naming.
2828

2929
Nouns and noun phrases should be used rarely and they might indicate that the type should be an abstract class, and not an interface.
3030

31-
❌ DO NOT give class names a prefix (for example, "C").
31+
❌ DO NOT give class names a prefix (e.g., "C").
3232

3333
✔️ CONSIDER ending the name of derived classes with the name of the base class.
3434

@@ -94,7 +94,7 @@ public interface ISessionChannel<TSession> where TSession : ISession {
9494

9595
❌ DO NOT use "Flag" or "Flags" suffixes in enum type names.
9696

97-
❌ DO NOT use a prefix on enumeration value names (for example, "ad" for ADO enums, "rtf" for rich text enums, etc.).
97+
❌ DO NOT use a prefix on enumeration value names (e.g., "ad" for ADO enums, "rtf" for rich text enums, etc.).
9898

9999
*Portions © 2005, 2009 Microsoft Corporation. All rights reserved.*
100100

docs/standard/design-guidelines/names-of-namespaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ As with other naming guidelines, the goal when naming namespaces is creating suf
2929

3030
❌ DO NOT use organizational hierarchies as the basis for names in namespace hierarchies, because group names within corporations tend to be short-lived. Organize the hierarchy of namespaces around groups of related technologies.
3131

32-
✔️ DO use PascalCasing, and separate namespace components with periods (for example, `Microsoft.Office.PowerPoint`). If your brand employs nontraditional casing, you should follow the casing defined by your brand, even if it deviates from normal namespace casing.
32+
✔️ DO use PascalCasing, and separate namespace components with periods (e.g., `Microsoft.Office.PowerPoint`). If your brand employs nontraditional casing, you should follow the casing defined by your brand, even if it deviates from normal namespace casing.
3333

3434
✔️ CONSIDER using plural namespace names where appropriate.
3535

docs/standard/design-guidelines/property.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Although properties are technically very similar to methods, they are quite diff
5353

5454
If the design requires other types of parameters, strongly reevaluate whether the API really represents an accessor to a logical collection. If it does not, use a method. Consider starting the method name with `Get` or `Set`.
5555

56-
✔️ DO use the name `Item` for indexed properties unless there is an obviously better name (for example, see the <xref:System.String.Chars%2A> property on `System.String`).
56+
✔️ DO use the name `Item` for indexed properties unless there is an obviously better name (e.g., see the <xref:System.String.Chars%2A> property on `System.String`).
5757

5858
In C#, indexers are by default named Item. The <xref:System.Runtime.CompilerServices.IndexerNameAttribute> can be used to customize this name.
5959

docs/standard/design-guidelines/usage-guidelines.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
description: "Learn more about: Usage guidelines"
33
title: "Usage guidelines"
44
ms.date: "10/22/2008"
5-
helpviewer_keywords:
5+
helpviewer_keywords:
66
- "class library design guidelines [.NET Framework], usage guidelines"
77
ms.assetid: 42215ffa-a099-4a26-b14e-fb2bdb6f95b7
88
---
99
# Usage guidelines
1010

11-
This section contains guidelines for using common types in publicly accessible APIs. It deals with direct usage of built-in Framework types (for example, serialization attributes) and overloading common operators.
12-
11+
This section contains guidelines for using common types in publicly accessible APIs. It deals with direct usage of built-in Framework types (e.g., serialization attributes) and overloading common operators.
12+
1313
The <xref:System.IDisposable?displayProperty=nameWithType> interface is not covered in this section, but is discussed in the [Dispose Pattern](dispose-pattern.md) section.
1414

1515
> [!NOTE]
@@ -27,7 +27,7 @@ The <xref:System.IDisposable?displayProperty=nameWithType> interface is not cove
2727
*Portions © 2005, 2009 Microsoft Corporation. All rights reserved.*
2828

2929
*Reprinted by permission of Pearson Education, Inc. from [Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 2nd Edition](https://www.informit.com/store/framework-design-guidelines-conventions-idioms-and-9780321545619) by Krzysztof Cwalina and Brad Abrams, published Oct 22, 2008 by Addison-Wesley Professional as part of the Microsoft Windows Development Series.*
30-
30+
3131
## See also
3232

3333
- [Framework Design Guidelines](index.md)

0 commit comments

Comments
 (0)