/// <summary> /// Deserializes the segment as a specific JSON message. /// </summary> /// <typeparam name="T">The message type to deserialize as.</typeparam> /// <param name="buffer">The buffer to deserialize.</param> /// <returns></returns> public static T As <T>(this ArraySegment <byte> buffer) { return(JsonConvert.DeserializeObject <T>( buffer.AsString() )); }