TryReadNestedTlv Method
TryReadNestedTlv(out TlvReader, Int32)
Try to read the TLV at the current position as a NestedTlv. If this
succeeds, return true and set the nestedReader
argument to a
new TlvReader
object whose position is the beginning of the
NestedTlv's value, which is the tag of the NestedTlv's first
sub-element. Move the position of the original reader to the byte
beyond the current TLV.
public bool TryReadNestedTlv(out TlvReader nestedReader, int expectedTag)
Parameters
Type | Name | Description |
---|---|---|
TlvReader | nestedReader | On success, receives the new |
System.Int32 | expectedTag | The tag that should be at the current position, the NestedTlv's tag. |
Returns
Remarks
This is the same as ReadNestedTlv
, except this method will not
throw an exception if there is an error in reading, only return
false
. That is, if the expected tag is not found at the
current position, or the length octets are not a valid encoding, or
there is not enough data in the buffer for the length given, this
method will return false
.
See the documentation for ReadNestedTlv
for more information
on what this method does.