ArrayExtensions ClassDelta Engine Documentation
Additional array manipulation and array to text methods. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Extensions ArrayExtensions

Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public static class ArrayExtensions

The ArrayExtensions type exposes the following members.

Methods

  NameDescription
Public methodStatic memberCompare T 
Public methodStatic memberGetWithDefault Key, Value 
Public methodStatic memberInsert T 
Public methodStatic memberToText T 
Top
Remarks

Tests: DeltaEngine.Tests.Extensions.ArrayExtensionsTests
Examples

6 unit tests call DeltaEngine.Extensions.ArrayExtensions
[Test]
public void Compare()
{
    var numbers1 = new[] { 1, 2, 5 };
    var numbers2 = new[] { 1, 2, 5 };
    var numbers3 = new[] { 1, 2, 5, 7 };
    Assert.IsTrue(numbers1.Compare(numbers2));
    Assert.IsFalse(numbers1.Compare(null));
    Assert.IsFalse(numbers1.Compare(numbers3));
    Assert.IsFalse(numbers3.Compare(numbers1));
    byte[] optionalData = null;
    Assert.IsTrue(optionalData.Compare(null));
}
[Test]
public void ToText()
{
    var texts = new List<string> { "Hi", "there", "whats", "up?" };
    Assert.AreEqual("Hi, there, whats, up?", texts.ToText());
}
[Test]
public void GetWithDefaultReturnsDefaultIfNotInDictionary()
{
    int result = ArrayExtensions.GetWithDefault<string, int>(dictionary, "Missing");
    Assert.AreEqual(0, result);
}
See Also