public void DangerousGetUnderlyingArray() { ImmutableArray <byte> immutable = ImmutableArray.Create <byte>(1, 2, 3); byte[] array = ImmutableByteArrayInterop.DangerousGetUnderlyingArray(immutable); Assert.Equal(3, array.Length); Assert.Equal(1, array[0]); Assert.Equal(2, array[1]); Assert.Equal(3, array[2]); array[0] = 9; Assert.Equal(9, immutable[0]); }
public static BlobContentId FromHash(ImmutableArray <byte> hashCode) { return(FromHash(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(hashCode) !)); }
public BlobContentId(ImmutableArray <byte> id) : this(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(id) !) { }
/// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException">Range specified by <paramref name="start"/> and <paramref name="byteCount"/> falls outside of the bounds of the <paramref name="buffer"/>.</exception> /// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception> public void WriteBytes(ImmutableArray <byte> buffer, int start, int byteCount) { WriteBytes(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(buffer), start, byteCount); }
public void DangerousGetUnderlyingArrayNegativeTests() { ImmutableArray <byte> immutable = default(ImmutableArray <byte>); Assert.Null(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(immutable)); }
public PinnedBlob(ImmutableArray <byte> blob) : this(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(blob)) { }