Click or drag to resize
EnumerableExCatchTSource Method (IEnumerableTSource, IEnumerableTSource)
Creates a sequence that returns the elements of the first sequence, switching to the second in case of an error.

Namespace: System.Linq
Assembly: System.Interactive (in System.Interactive.dll) Version: 1.2.0.0
Syntax
C#
public static IEnumerable<TSource> Catch<TSource>(
	this IEnumerable<TSource> first,
	IEnumerable<TSource> second
)

Parameters

first
Type: System.Collections.GenericIEnumerableTSource
First sequence.
second
Type: System.Collections.GenericIEnumerableTSource
Second sequence, concatenated to the result in case the first sequence completes exceptionally.

Type Parameters

TSource
Source sequence element type.

Return Value

Type: IEnumerableTSource
The first sequence, followed by the second sequence in case an error is produced.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also