Created
February 28, 2014 02:10
-
-
Save trsneed/9263839 to your computer and use it in GitHub Desktop.
Abstracted ProductHeaderValue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Octokit | |
{ | |
public class ProductHeaderValue | |
{ | |
ProductHeaderValue() | |
{ | |
} | |
public ProductHeaderValue(string name) | |
{ | |
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name); | |
} | |
public ProductHeaderValue(string name, string value) | |
{ | |
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name, value); | |
} | |
System.Net.Http.Headers.ProductHeaderValue _productHeaderValue; | |
public string Name | |
{ | |
get { return _productHeaderValue.Name; } | |
} | |
public string Version | |
{ | |
get { return _productHeaderValue.Version; } | |
} | |
public override bool Equals(object obj) | |
{ | |
return _productHeaderValue.Equals(obj); | |
} | |
public override int GetHashCode() | |
{ | |
return _productHeaderValue.GetHashCode(); | |
} | |
public override string ToString() | |
{ | |
return _productHeaderValue.ToString(); | |
} | |
public static ProductHeaderValue Parse(string input) | |
{ | |
return new ProductHeaderValue { _productHeaderValue = System.Net.Http.Headers.ProductHeaderValue.Parse(input) }; | |
} | |
public static bool TryParse(string input, | |
out ProductHeaderValue parsedValue) | |
{ | |
System.Net.Http.Headers.ProductHeaderValue value; | |
var result = System.Net.Http.Headers.ProductHeaderValue.TryParse(input, out value); | |
parsedValue = result ? Parse(input) : null; | |
return result; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment