StreamExtensions static class StreamExtensions Documentation Code public static long? GetPositionOrDefault(this Stream content) Some streams will throw if you try to access their length so we wrap the check in a TryGet helper.