예제 #1
0
        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]);
        }
예제 #2
0
 public static BlobContentId FromHash(ImmutableArray <byte> hashCode)
 {
     return(FromHash(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(hashCode) !));
 }
예제 #3
0
 public BlobContentId(ImmutableArray <byte> id)
     : this(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(id) !)
 {
 }
예제 #4
0
 /// <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);
 }
예제 #5
0
        public void DangerousGetUnderlyingArrayNegativeTests()
        {
            ImmutableArray <byte> immutable = default(ImmutableArray <byte>);

            Assert.Null(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(immutable));
        }
예제 #6
0
 public PinnedBlob(ImmutableArray <byte> blob)
     : this(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(blob))
 {
 }