# Class LINQExtensions
Namespace: [CapyKit.Extensions](CapyKit.Extensions.md)
Assembly: CapyKit.dll
Provides static extension methods for performing common LINQ operations on and collections.
```csharp
public static class LINQExtensions
```
#### Inheritance
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[LINQExtensions](CapyKit.Extensions.LINQExtensions.md)
#### Inherited Members
[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone\(\)](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone),
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
#### Extension Methods
[ObjectExtensions.UpdateProperties\(object, object\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_System\_Object\_System\_Object\_)
## Methods
### Distinct\(IEnumerable, Func\)
Enumerates distinct items in this collection as defined by the key property.
```csharp
public static IEnumerable Distinct(this IEnumerable items, Func property)
```
#### Parameters
`items` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
The items to act on.
`property` [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)
The property.
#### Returns
[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
An enumerator that allows foreach to be used to process distinct items in this collection.
#### Type Parameters
`T`
Generic type parameter of the parent object.
`U`
Generic type parameter property value.
### Filter\(IEnumerable, Func\)
Filters out items matching a predicate from the collection.
```csharp
public static IEnumerable Filter(this IEnumerable source, Func predicate)
```
#### Parameters
`source` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
The source to act on.
`predicate` [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)
The predicate.
#### Returns
[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
An enumerator that allows foreach to be used to process remove in this collection.
#### Type Parameters
`T`
Generic type parameter.
### Filter\(IQueryable, Expression\>\)
Filters out items matching a predicate from the collection.
```csharp
public static IQueryable Filter(this IQueryable source, Expression> predicate)
```
#### Parameters
`source` [IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
The source to act on.
`predicate` [Expression](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression\-1)<[Func](https://learn.microsoft.com/dotnet/api/system.func\-2)\>
The predicate.
#### Returns
[IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
An enumerator that allows foreach to be used to process remove in this collection.
#### Type Parameters
`T`
Generic type parameter.
### LeftOuterJoin\(IQueryable, IQueryable, Expression\>, Expression\>, Func, R\>, Func\)
An IQueryable<T> extension method that left outer join.
```csharp
public static IQueryable LeftOuterJoin(this IQueryable source, IQueryable inner, Expression> outerSelector, Expression> innerSelector, Func, R> resultSelector, Func defaultGenerator = null)
```
#### Parameters
`source` [IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
The source to act on.
`inner` [IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
The inner.
`outerSelector` [Expression](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression\-1)<[Func](https://learn.microsoft.com/dotnet/api/system.func\-2)\>
The outer selector.
`innerSelector` [Expression](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression\-1)<[Func](https://learn.microsoft.com/dotnet/api/system.func\-2)\>
The inner selector.
`resultSelector` [Func](https://learn.microsoft.com/dotnet/api/system.func\-3), R\>
The result selector.
`defaultGenerator` [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)
(Optional) The default generator.
#### Returns
[IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
An IQueryable<R>
#### Type Parameters
`T`
Generic type parameter.
`U`
Generic type parameter.
`TKey`
Type of the key.
`R`
Type of the r.
### LeftOuterJoin\(IEnumerable, IEnumerable, Func, Func, Func, R\>, Func\)
An IEnumable<T> extension method that left outer join.
```csharp
public static IEnumerable LeftOuterJoin(this IEnumerable source, IEnumerable inner, Func outerSelector, Func innerSelector, Func, R> resultSelector, Func defaultGenerator = null)
```
#### Parameters
`source` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
The source to act on.
`inner` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
The inner.
`outerSelector` [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)
The outer selector.
`innerSelector` [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)
The inner selector.
`resultSelector` [Func](https://learn.microsoft.com/dotnet/api/system.func\-3), R\>
The result selector.
`defaultGenerator` [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)
(Optional) The default generator.
#### Returns
[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
An enumerator that allows foreach to be used to process left outter join in this collection.
#### Type Parameters
`T`
Generic type parameter.
`U`
Generic type parameter.
`TKey`
Type of the key.
`R`
Type of the r.
### Page\(IEnumerable, int, int\)
Get a page of items from a collection, skipping pageNumber pages of
pageSize items per page.
```csharp
public static IEnumerable Page(this IEnumerable source, int pageNumber, int pageSize)
```
#### Parameters
`source` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
The source to act on.
`pageNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)
The page number to retrieve.
`pageSize` [int](https://learn.microsoft.com/dotnet/api/system.int32)
Number of items per page.
#### Returns
[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
An enumerator that allows foreach to be used to process page in this collection.
#### Type Parameters
`T`
Generic type parameter.
#### Remarks
This method uses natural numbering starting at page 1.
#### Exceptions
[ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)
Thrown when pageNumber is less than 1 or if
pageSize is less than
1.
### Page\(IQueryable, int, int\)
Get a page of items from a collection, skipping pageNumber pages of
pageSize items per page.
```csharp
public static IQueryable Page(this IQueryable source, int pageNumber, int pageSize)
```
#### Parameters
`source` [IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
The source to act on.
`pageNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)
The page number to retrieve.
`pageSize` [int](https://learn.microsoft.com/dotnet/api/system.int32)
.
#### Returns
[IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
An enumerator that allows foreach to be used to process page in this collection.
#### Type Parameters
`T`
Generic type parameter.
#### Remarks
This method uses natural numbering starting at page 1.
#### Exceptions
[ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)
Thrown when pageNumber is less than 1 or if
pageSize is less than
1.
### PageCount\(IEnumerable, int\)
The number of pages of pageSize size in the given collection.
```csharp
public static int PageCount(this IEnumerable source, int pageSize)
```
#### Parameters
`source` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)
The source to act on.
`pageSize` [int](https://learn.microsoft.com/dotnet/api/system.int32)
Size of the page.
#### Returns
[int](https://learn.microsoft.com/dotnet/api/system.int32)
An int.
#### Type Parameters
`T`
Generic type parameter.
#### Exceptions
[ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)
Thrown when pageSize is less than 1.
### PageCount\(IQueryable, int\)
The number of pages of pageSize size in the given collection.
```csharp
public static int PageCount(this IQueryable source, int pageSize)
```
#### Parameters
`source` [IQueryable](https://learn.microsoft.com/dotnet/api/system.linq.iqueryable\-1)
The source to act on.
`pageSize` [int](https://learn.microsoft.com/dotnet/api/system.int32)
Size of the page.
#### Returns
[int](https://learn.microsoft.com/dotnet/api/system.int32)
An int.
#### Type Parameters
`T`
Generic type parameter.
#### Exceptions
[ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)
Thrown when pageSize is less than 1.