zoukankan      html  css  js  c++  java
  • OperationResult

    public class OperationResult<T> {
    
    private readonly ConcurrentDictionary<string, T> _values =
    
    new ConcurrentDictionary<string, T>();
    
    public OperationResult() { }
    
    public OperationResult(bool success) : this(success, String.Empty) { }
    
    public OperationResult(string message) : this(false, message) { }
    
    public OperationResult(bool success, string message) : this() {
    Success = success;
    Message = message;
    }
    
    public int Count {
    get { return _values.Count; }
    }
    
    public T this[string key] {
    get { return _values[key]; }
    set { _values[key] = value; }
    }
    
    public string Message { get; set; }
    
    public bool Success { get; set; }
    
    public override string ToString() {
    return String.Format("{0}:{1}{2}", Success ? "PASS" : "FAIL", Message,
    Count == 0 ? String.Empty :
    String.Format("({0})", String.Join(";", _values.OrderBy(o => o.Key)
    .Select(s => String.Format("{0}:"{1}"", s.Key, s.Value)))));
    }
    }
    
  • 相关阅读:
    求全排列,调用C++函数
    ZOJ 3508 (the war)
    HDU 1285
    SDUT--枚举(删数问题)
    SDUT--进制转换
    位运算
    [NOI2015]软件包管理器
    列队[noip2017]
    [APIO2007]动物园
    [NOI2001]炮兵阵地
  • 原文地址:https://www.cnblogs.com/zeroone/p/5043553.html
Copyright © 2011-2022 走看看