-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from MADE-Apps/feature/archived-port
Port of usable components from personal archived projects
- Loading branch information
Showing
7 changed files
with
379 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/MADE.Data.Converters/Extensions/CollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// MADE Apps licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace MADE.Data.Converters.Extensions | ||
{ | ||
using System.Collections.Generic; | ||
|
||
/// <summary> | ||
/// Defines a collection of extensions for collection objects. | ||
/// </summary> | ||
public static class CollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Converts a collection of items to a string separated by a delimiter. | ||
/// </summary> | ||
/// <typeparam name="T">The type of item within the collection.</typeparam> | ||
/// <param name="source">The source collection to convert.</param> | ||
/// <param name="delimiter">The delimiter to separate items by in the string. Default, comma.</param> | ||
/// <returns>A delimited string representing the collection.</returns> | ||
public static string ToDelimitedString<T>(this IEnumerable<T> source, string delimiter = ",") | ||
{ | ||
return string.Join(delimiter, source); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace MADE.Data.Converters.Extensions | ||
{ | ||
/// <summary> | ||
/// Defines a collection of extensions for converting length measurements. | ||
/// </summary> | ||
public static class LengthExtensions | ||
{ | ||
/// <summary> | ||
/// Converts a distance measured in miles to a distance measured in meters. | ||
/// </summary> | ||
/// <param name="miles">The miles to convert to meters.</param> | ||
/// <returns>The meters that represent the miles.</returns> | ||
public static double ToMeters(this double miles) | ||
{ | ||
return miles * 1609.344; | ||
} | ||
|
||
/// <summary> | ||
/// Converts a distance measured in meters to a distance measured in miles. | ||
/// </summary> | ||
/// <param name="meters">The meters to convert to miles.</param> | ||
/// <returns>The miles that represent the meters.</returns> | ||
public static double ToMiles(this double meters) | ||
{ | ||
return meters / 1609.344; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.