Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/standard/datetime/access-utc-and-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], local"
- "time zones [.NET], local"
- "predefined time zones"
- "UTC times, predefined"
- "local time zone access"
- "time zones [.NET Framework], retrieving"
- "time zones [.NET Framework], UTC"
- "time zones [.NET], retrieving"
- "time zones [.NET], UTC"
ms.assetid: 961fb70b-83f0-4dab-a042-cb5fcd817cf5
---
# How to: Access the predefined UTC and local time zone objects
Expand Down
6 changes: 3 additions & 3 deletions docs/standard/datetime/choosing-between-datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ dev_langs:
helpviewer_keywords:
- "DateTimeOffset structure"
- "TimeZoneInfo class"
- "time zones [.NET Framework], common uses"
- "date and time classes [.NET Framework]"
- "time zones [.NET Framework], type options"
- "time zones [.NET], common uses"
- "date and time classes [.NET]"
- "time zones [.NET], type options"
- "DateTime structure"
ms.assetid: 07f17aad-3571-4014-9ef3-b695a86f3800
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ dev_langs:
- "vb"
helpviewer_keywords:
- "DateTime structure, converting"
- "time zones [.NET Framework], conversions"
- "time zones [.NET], conversions"
- "UTC times, converting"
- "DateTimeOffset structure, converting"
- "converting DateTimeOffset and DateTime values"
- "dates [.NET Framework], converting"
- "dates [.NET], converting"
- "converting times"
- "Date data type, converting"
- "local time conversions"
Expand Down
8 changes: 4 additions & 4 deletions docs/standard/datetime/converting-between-time-zones.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "times [.NET Framework], converting"
- "time zones [.NET Framework], conversions"
- "times [.NET], converting"
- "time zones [.NET], conversions"
- "UTC times, converting"
- "converting times"
- "local time conversions"
Expand All @@ -20,7 +20,7 @@ It is becoming increasingly important for any application that works with dates

## Converting to Coordinated Universal Time

Coordinated Universal Time (UTC) is a high-precision, atomic time standard. The worlds time zones are expressed as positive or negative offsets from UTC. Thus, UTC provides a kind of time-zone free or time-zone neutral time. The use of UTC time is recommended when a date and time's portability across computers is important. (For details and other best practices using dates and times, see [Coding best practices using DateTime in the .NET Framework](/previous-versions/dotnet/articles/ms973825(v=msdn.10)).) Converting individual time zones to UTC makes time comparisons easy.
Coordinated Universal Time (UTC) is a high-precision, atomic time standard. The world's time zones are expressed as positive or negative offsets from UTC. Thus, UTC provides a kind of time-zone free or time-zone neutral time. The use of UTC time is recommended when a date and time's portability across computers is important. (For details and other best practices using dates and times, see [Coding best practices using DateTime in the .NET Framework](/previous-versions/dotnet/articles/ms973825(v=msdn.10)).) Converting individual time zones to UTC makes time comparisons easy.

> [!NOTE]
> You can also serialize a <xref:System.DateTimeOffset> structure to unambiguously represent a single point in time. Because <xref:System.DateTimeOffset> objects store a date and time value along with its offset from UTC, they always represent a particular point in time in relationship to UTC.
Expand Down Expand Up @@ -65,7 +65,7 @@ The following code converts UTC to Central Standard Time.

## Converting UTC to local time

To convert UTC to local time, call the <xref:System.DateTime.ToLocalTime%2A> method of the <xref:System.DateTime> object whose time you want to convert. The exact behavior of the method depends on the value of the objects <xref:System.DateTime.Kind%2A> property, as the following table shows.
To convert UTC to local time, call the <xref:System.DateTime.ToLocalTime%2A> method of the <xref:System.DateTime> object whose time you want to convert. The exact behavior of the method depends on the value of the object's <xref:System.DateTime.Kind%2A> property, as the following table shows.

| `DateTime.Kind` | Conversion |
| -------------------------- | ---------------------------------------------------------------------------------------- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], creating"
- "time zones [.NET Framework], and adjustment rules"
- "adjustment rule [.NET Framework]"
- "time zones [.NET], creating"
- "time zones [.NET], and adjustment rules"
- "adjustment rule [.NET]"
ms.assetid: c52ef192-13a9-435f-8015-3b12eae8c47c
---
# How to: Create time zones with adjustment rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], adjustment rule"
- "time zones [.NET Framework], creating"
- "adjustment rule [.NET Framework]"
- "time zones [.NET], adjustment rule"
- "time zones [.NET], creating"
- "adjustment rule [.NET]"
ms.assetid: a6af8647-7893-4f29-95a9-d94c65a6e8dd
---
# How to: Create time zones without adjustment rules
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/datetime/enumerate-time-zones.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], enumerating"
- "enumerating time zones [.NET Framework]"
- "time zones [.NET], enumerating"
- "enumerating time zones [.NET]"
ms.assetid: bb7a42ab-6bd9-4c5c-b734-5546d51f8669
---
# How to: Enumerate time zones present on a computer
Expand Down
10 changes: 5 additions & 5 deletions docs/standard/datetime/finding-the-time-zones-on-local-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ title: "Finding the time zones defined on a local system"
ms.date: "04/10/2017"
ms.technology: dotnet-standard
helpviewer_keywords:
- "time zones [.NET Framework], local"
- "time zones [.NET Framework], finding local system time zones"
- "time zone identifiers [.NET Framework]"
- "time zones [.NET], local"
- "time zones [.NET], finding local system time zones"
- "time zone identifiers [.NET]"
- "local time zone access"
- "time zones [.NET Framework], retrieving"
- "time zones [.NET], retrieving"
- "UTC times, finding local system time zones"
- "time zones [.NET Framework], UTC"
- "time zones [.NET], UTC"
ms.assetid: 3f63b1bc-9a4b-4bde-84ea-ab028a80d3e1
---
# Finding the time zones defined on a local system
Expand Down
10 changes: 5 additions & 5 deletions docs/standard/datetime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ title: "Dates, times, and time zones"
ms.date: "04/10/2017"
ms.technology: dotnet-standard
helpviewer_keywords:
- "time zone objects [.NET Framework]"
- "date and time data [.NET Framework]"
- "time zones [.NET Framework]"
- "times [.NET Framework], time zones"
- "time [.NET Framework], time zones"
- "time zone objects [.NET]"
- "date and time data [.NET]"
- "time zones [.NET]"
- "times [.NET], time zones"
- "time [.NET], time zones"
ms.assetid: 295c16e0-641b-4771-94b3-39c1ffa98c13
---
# Dates, times, and time zones
Expand Down
2 changes: 1 addition & 1 deletion docs/standard/datetime/instantiate-time-zone-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dev_langs:
- "vb"
helpviewer_keywords:
- "instantiating time zone objects"
- "time zone objects [.NET Framework], instantiation"
- "time zone objects [.NET], instantiation"
ms.assetid: 8cb620e5-c6a6-4267-a52e-beeb73cd1a34
---
# How to: Instantiate a TimeZoneInfo object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dev_langs:
- "vb"
helpviewer_keywords:
- "instantiating time zone objects"
- "time zone objects [.NET Framework], instantiation"
- "time zone objects [.NET], instantiation"
- "DateTimeOffset structure, converting to DateTime"
- "DateTimeOffset structure, instantiating"
ms.assetid: 9648375f-d368-4373-a976-3332ece00c0a
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/datetime/let-users-resolve-ambiguous-times.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: "How to: Let users resolve ambiguous times"
ms.date: "04/10/2017"
ms.technology: dotnet-standard
helpviewer_keywords:
- "time zones [.NET Framework], ambiguous time"
- "ambiguous time [.NET Framework]"
- "time zones [.NET], ambiguous time"
- "ambiguous time [.NET]"
ms.assetid: bca874ee-5b68-4654-8bbd-3711220ef332
---
# How to: Let users resolve ambiguous times
Expand Down
10 changes: 5 additions & 5 deletions docs/standard/datetime/performing-arithmetic-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "times [.NET Framework], arithmetic operations"
- "dates [.NET Framework], arithmetic operations"
- "time zones [.NET Framework], arithmetic operations"
- "arithmetic operations [.NET Framework], dates and times"
- "dates [.NET Framework], comparing"
- "times [.NET], arithmetic operations"
- "dates [.NET], arithmetic operations"
- "time zones [.NET], arithmetic operations"
- "arithmetic operations [.NET], dates and times"
- "dates [.NET], comparing"
- "DateTime structure, arithmetic operations"
- "DateTimeOffset structure, arithmetic operations"
ms.assetid: 87c7ddf2-f15e-48af-8602-b3642237e6d0
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/datetime/resolve-ambiguous-times.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], ambiguous time"
- "ambiguous time [.NET Framework]"
- "time zones [.NET], ambiguous time"
- "ambiguous time [.NET]"
ms.assetid: 2cf5fb25-492c-4875-9245-98cac8348e97
---
# How to: Resolve ambiguous times
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], deserializing"
- "time zones [.NET Framework], restoring"
- "time zones [.NET], deserializing"
- "time zones [.NET], restoring"
ms.assetid: 6b7b4de9-da07-47e3-8f4c-823f81798ee7
---
# How to: Restore time zones from an embedded resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], saving"
- "time zone objects [.NET Framework], serializing"
- "time zone objects [.NET Framework], saving"
- "time zones [.NET], saving"
- "time zone objects [.NET], serializing"
- "time zone objects [.NET], saving"
ms.assetid: 3c96d83a-a057-4496-abb0-8f4b12712558
---
# How to: Save time zones to an embedded resource
Expand Down
16 changes: 8 additions & 8 deletions docs/standard/datetime/saving-and-restoring-time-zones.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ dev_langs:
- "vb"
helpviewer_keywords:
- "restoring time zones"
- "deserialization [.NET Framework], time zones"
- "serialization [.NET Framework], time zones"
- "time zone objects [.NET Framework], restoring"
- "deserialization [.NET], time zones"
- "serialization [.NET], time zones"
- "time zone objects [.NET], restoring"
- "saving time zones"
- "time zone objects [.NET Framework], deserializing"
- "time zones [.NET Framework], saving"
- "time zones [.NET Framework], restoring"
- "time zone objects [.NET Framework], serializing"
- "time zone objects [.NET Framework], saving"
- "time zone objects [.NET], deserializing"
- "time zones [.NET], saving"
- "time zones [.NET], restoring"
- "time zone objects [.NET], serializing"
- "time zone objects [.NET], saving"
ms.assetid: 4028b310-e7ce-49d4-a646-1e83bfaf6f9d
---
# Saving and restoring time zones
Expand Down
20 changes: 10 additions & 10 deletions docs/standard/datetime/time-zone-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ title: "Time zone overview"
ms.date: "04/10/2017"
ms.technology: dotnet-standard
helpviewer_keywords:
- "time zones [.NET Framework], about time zones"
- "transition time [.NET Framework]"
- "time zones [.NET], about time zones"
- "transition time [.NET]"
- "TimeZoneInfo class, about TimeZoneInfo class"
- "time zones [.NET Framework], creating"
- "invalid time [.NET Framework]"
- "fixed rule [.NET Framework]"
- "ambiguous time [.NET Framework]"
- "floating rule [.NET Framework]"
- "daylight saving time [.NET Framework]"
- "adjustment rule [.NET Framework]"
- "time zones [.NET Framework], terminology"
- "time zones [.NET], creating"
- "invalid time [.NET]"
- "fixed rule [.NET]"
- "ambiguous time [.NET]"
- "floating rule [.NET]"
- "daylight saving time [.NET]"
- "adjustment rule [.NET]"
- "time zones [.NET], terminology"
ms.assetid: c4b7ed01-5e38-4959-a3b6-ef9765d6ccf1
---
# Time zone overview
Expand Down
6 changes: 3 additions & 3 deletions docs/standard/datetime/use-time-zones-in-arithmetic.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "time zones [.NET Framework], arithmetic operations"
- "arithmetic operations [.NET Framework], dates and times"
- "dates [.NET Framework], adding and subtracting"
- "time zones [.NET], arithmetic operations"
- "arithmetic operations [.NET], dates and times"
- "dates [.NET], adding and subtracting"
ms.assetid: 83dd898d-1338-415d-8cd6-445377ab7871
---
# How to: Use time zones in date and time arithmetic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ dev_langs:
- "vb"
- "cpp"
helpviewer_keywords:
- "event properties [.NET Framework]"
- "multiple events [.NET Framework]"
- "event handling [.NET Framework], with multiple events"
- "events [.NET Framework], multiple"
- "event properties [.NET]"
- "multiple events [.NET]"
- "event handling [.NET], with multiple events"
- "events [.NET], multiple"
ms.assetid: 30047cba-e2fd-41c6-b9ca-2ad7a49003db
---
# How to: Handle Multiple Events Using Event Properties
Expand Down
6 changes: 3 additions & 3 deletions docs/standard/events/how-to-implement-a-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "observer design pattern [.NET Framework], implementing providers"
- "providers [.NET Framework], in observer design pattern"
- "observables [.NET Framework], in observer design pattern"
- "observer design pattern [.NET], implementing providers"
- "providers [.NET], in observer design pattern"
- "observables [.NET], in observer design pattern"
ms.assetid: 790b5d8b-d546-40a6-beeb-151b574e5ee5
---
# How to: Implement a Provider
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/events/how-to-implement-an-observer.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "observers [.NET Framework], observer design pattern"
- "observer design pattern [.NET Framework], implementing observers"
- "observers [.NET], observer design pattern"
- "observer design pattern [.NET], implementing observers"
ms.assetid: 8ecfa9f5-b500-473d-bcf0-5652ffb1e53d
---
# How to: Implement an Observer
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/events/how-to-raise-and-consume-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ dev_langs:
- "vb"
- "cpp"
helpviewer_keywords:
- "events [.NET Framework], raising"
- "events [.NET], raising"
- "raising events"
- "events [.NET Framework], samples"
- "events [.NET], samples"
ms.assetid: 42afade7-3a02-4f2e-868b-95845f302f8f
---
# How to: Raise and Consume Events
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ dev_langs:
helpviewer_keywords:
- "delegate model for events"
- "application development [.NET], events"
- "application development [.NET Framework], events"
- "application development [.NET], events"
- "application development [.NET Core], events"
- "events [.NET]"
- "events [.NET Core]"
- "events [.NET Framework]"
- "events [.NET]"
ms.assetid: b6f65241-e0ad-4590-a99f-200ce741bb1f
---
# Handle and raising events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ title: "Observer Design Pattern Best Practices"
ms.date: "03/30/2017"
ms.technology: dotnet-standard
helpviewer_keywords:
- "observer design pattern [.NET Framework], best practices"
- "best practices [.NET Framework], observer design pattern"
- "observer design pattern [.NET], best practices"
- "best practices [.NET], observer design pattern"
ms.assetid: c834760f-ddd4-417f-abb7-a059679d5b8c
---
# Observer Design Pattern Best Practices
In the .NET Framework, the observer design pattern is implemented as a set of interfaces. The <xref:System.IObservable%601?displayProperty=nameWithType> interface represents the data provider, which is also responsible for providing an <xref:System.IDisposable> implementation that lets observers unsubscribe from notifications. The <xref:System.IObserver%601?displayProperty=nameWithType> interface represents the observer. This topic describes the best practices that developers should follow when implementing the observer design pattern using these interfaces.

In .NET, the observer design pattern is implemented as a set of interfaces. The <xref:System.IObservable%601?displayProperty=nameWithType> interface represents the data provider, which is also responsible for providing an <xref:System.IDisposable> implementation that lets observers unsubscribe from notifications. The <xref:System.IObserver%601?displayProperty=nameWithType> interface represents the observer. This topic describes the best practices that developers should follow when implementing the observer design pattern using these interfaces.

## Threading
Typically, a provider implements the <xref:System.IObservable%601.Subscribe%2A?displayProperty=nameWithType> method by adding a particular observer to a subscriber list that is represented by some collection object, and it implements the <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> method by removing a particular observer from the subscriber list. An observer can call these methods at any time. In addition, because the provider/observer contract does not specify who is responsible for unsubscribing after the <xref:System.IObserver%601.OnCompleted%2A?displayProperty=nameWithType> callback method, the provider and observer may both try to remove the same member from the list. Because of this possibility, both the <xref:System.IObservable%601.Subscribe%2A> and <xref:System.IDisposable.Dispose%2A> methods should be thread-safe. Typically, this involves using a [concurrent collection](../parallel-programming/data-structures-for-parallel-programming.md) or a lock. Implementations that are not thread-safe should explicitly document that they are not.
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/events/observer-design-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ helpviewer_keywords:
- "IObservable<T> interface"
- "IObserver<T> interface"
- "IObservable(Of T) interface"
- "observer design pattern [.NET Framework]"
- "observer design pattern [.NET]"
ms.assetid: 3680171f-f522-453c-aa4a-54f755a78f88
---
# Observer Design Pattern

The observer design pattern enables a subscriber to register with and receive notifications from a provider. It is suitable for any scenario that requires push-based notification. The pattern defines a *provider* (also known as a *subject* or an *observable*) and zero, one, or more *observers*. Observers register with the provider, and whenever a predefined condition, event, or state change occurs, the provider automatically notifies all observers by calling one of their methods. In this method call, the provider can also provide current state information to observers. In the .NET Framework, the observer design pattern is applied by implementing the generic <xref:System.IObservable%601?displayProperty=nameWithType> and <xref:System.IObserver%601?displayProperty=nameWithType> interfaces. The generic type parameter represents the type that provides notification information.
The observer design pattern enables a subscriber to register with and receive notifications from a provider. It is suitable for any scenario that requires push-based notification. The pattern defines a *provider* (also known as a *subject* or an *observable*) and zero, one, or more *observers*. Observers register with the provider, and whenever a predefined condition, event, or state change occurs, the provider automatically notifies all observers by calling one of their methods. In this method call, the provider can also provide current state information to observers. In .NET, the observer design pattern is applied by implementing the generic <xref:System.IObservable%601?displayProperty=nameWithType> and <xref:System.IObserver%601?displayProperty=nameWithType> interfaces. The generic type parameter represents the type that provides notification information.

## Applying the Pattern

Expand Down
2 changes: 1 addition & 1 deletion docs/standard/garbage-collection/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ms.technology: dotnet-standard
helpviewer_keywords:
- "memory, garbage collection"
- "garbage collection, automatic memory management"
- "GC [.NET Framework]"
- "GC [.NET]"
- "memory, allocating"
- "common language runtime, garbage collection"
- "garbage collector"
Expand Down
Loading