Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // prototype
- var someValue = someCondition
- ? trueValue
- : falseValue
- ;
- // proper form in actual use
- public static System.String GetWebString( this System.Byte[] response, System.Text.Encoding encoding, System.String contentEncoding ) {
- return ( contentEncoding.TrimToNull() ?? "identity" ).Equals( "identity", System.StringComparison.OrdinalIgnoreCase )
- ? response.GetString( encoding )
- : contentEncoding.Equals( "gzip", System.StringComparison.OrdinalIgnoreCase )
- ? response.Gunzip( encoding )
- : contentEncoding.Equals( "deflate", System.StringComparison.OrdinalIgnoreCase )
- ? response.Inflate( encoding )
- : throw new System.InvalidOperationException( System.String.Format(
- "Unknown Content-Encoding value received from server: {0}",
- contentEncoding
- ) )
- ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement