-
Notifications
You must be signed in to change notification settings - Fork 4
Slice
Zohaib Sibte Hassan edited this page Mar 11, 2016
·
1 revision
No matter how tough the meat may be, it's going to be tender if you slice it thin enough.
Slices is a basic abstraction that contains a length and a pointer to an external byte array. Just like IBuffer and many other abstraction it sits closer to what LevelDB dictates in it's documentation. To make it more usable in C# it provides two class methods:
-
ToByteArray(bool deepCopy = true)
returns a deep or shallow copy of wrapped bytes (BECAREFUL WHILE USING SHALLOW COPY. Making changes to byte array of shallow copy may have undesired effect) -
ToString()
overrides and returns string interpretation of wrapped bytes.
There are two more static methods FromByteArray
and FromString
that let's you create Slice objects out of byte[]
and string
objects.