//-----------------------------------------------------------------------
//
// Copyright 2012 - Present Stuart Grassie
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//----------------------------------------------------------------------
namespace GitHubAPI.Core
{
using System;
public interface IHeader
{
string Name { get; set; }
string Value { get; set; }
}
public class Header : IHeader, IEquatable
{
public Header(string name, string value)
{
Name = name;
Value = value;
}
public bool Equals(Header other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return string.Equals(Name, other.Name) && string.Equals(Value, other.Value);
}
public override int GetHashCode()
{
unchecked
{
return ((Name != null ? Name.GetHashCode() : 0)*397) ^ (Value != null ? Value.GetHashCode() : 0);
}
}
public static bool operator ==(Header left, Header right)
{
return Equals(left, right);
}
public static bool operator !=(Header left, Header right)
{
return !Equals(left, right);
}
public string Name { get; set; }
public string Value { get; set; }
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
var other = obj as Header;
return other != null && Equals(other);
}
}
}