You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using Apewer.Internals; using System; using System.Collections.Generic; using System.Text;
namespace Apewer.Internals {
/// <summary>文本对。</summary>
internal struct TextPair {
private string _key; private string _value;
public string Key { get { return _key ?? ""; } set { _key = value ?? ""; } }
public string Value { get { return _value ?? ""; } set { _value = value ?? ""; } }
public bool NotEmpty { get { return !string.IsNullOrEmpty(_key) && !string.IsNullOrEmpty(_value); } }
public bool EmptyBoth { get { return string.IsNullOrEmpty(_key) && string.IsNullOrEmpty(_value); } }
public bool EmptyKey { get { return string.IsNullOrEmpty(_key); } }
public bool EmptyValue { get { return string.IsNullOrEmpty(_value); } }
public TextPair(string argKey) { _key = argKey ?? ""; _value = ""; }
public TextPair(string argKey, string argValue) { _key = argKey ?? ""; _value = argValue ?? ""; }
public override int GetHashCode() { var merge = TextGenerator.Merge(_key, " : ", _value); var hashcode = merge.GetHashCode(); return hashcode; }
public override bool Equals(object obj) { if (obj == null) return false; return (_key == ((TextPair)obj)._key) && (_value == ((TextPair)obj)._value); }
public static bool operator ==(TextPair a, TextPair b) { return (a._key == b._key) && (a._value == b._value); }
public static bool operator !=(TextPair a, TextPair b) { return (a._key != b._key) || (a._value != b._value); }
}
}
|