Additional array manipulation and array to text methods.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Extensions ArrayExtensions
Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ArrayExtensions type exposes the following members.
Methods
Name | Description | |
---|---|---|
Compare T | ||
GetWithDefault Key, Value | ||
Insert T | ||
ToText T |
Remarks
Examples
[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