5 deleted 6 characters in body
source | link
    public Field[] Issues { get; set; }

    public bool HasErrors
    {
        get
        {
            if (!HasNoIssuesHasIssues)
            {
                return Issues.Any(x => x.Name == "Errors");
            }
            return false;
        }
    }

    public bool HasIssues
    {
        get
        {
            return Issues != null && Issues.Length > 0;
        }
    }

    public bool HasWarnings
    {
        get
        {
            if (!HasNoIssuesHasIssues)
            {
                return Issues.Any(x => x.Name == "Warnings");
            }
            return false;
        }
    }

    public ResponseTags[] GetErrors()
    {
        if (HasErrors)
        {
            return Issues.First(x => x.Name == "Errors").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    public ResponseTags[] GetWarnings()
    {
        if (HasWarnings)
        {
            return Issues.First(x => x.Name == "Warnings").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    // For the display functions:
    // I don't understand why you only usses the first
    // groups of errors and warnings, but that may be a requirement.

    public string GetErrorsDisplayData()
    {
        var errorString = "";
        if (HasErrors)
        {
            errorString += Issues.First(x => x.Name == "Errors")
                .Groups.First()
                .Errors.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return errorString;
    }

    public string GetWarningsDisplayData()
    {
        var warningString = "";
        if (HasWarnings)
        {
            warningString += Issues.First(x => x.Name == "Warnings")
                .Groups.First()
                .Warnings.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return warningString;
    }
    public Field[] Issues { get; set; }

    public bool HasErrors
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Errors");
            }
            return false;
        }
    }

    public bool HasIssues
    {
        get
        {
            return Issues != null && Issues.Length > 0;
        }
    }

    public bool HasWarnings
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Warnings");
            }
            return false;
        }
    }

    public ResponseTags[] GetErrors()
    {
        if (HasErrors)
        {
            return Issues.First(x => x.Name == "Errors").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    public ResponseTags[] GetWarnings()
    {
        if (HasWarnings)
        {
            return Issues.First(x => x.Name == "Warnings").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    // For the display functions:
    // I don't understand why you only usses the first
    // groups of errors and warnings, but that may be a requirement.

    public string GetErrorsDisplayData()
    {
        var errorString = "";
        if (HasErrors)
        {
            errorString += Issues.First(x => x.Name == "Errors")
                .Groups.First()
                .Errors.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return errorString;
    }

    public string GetWarningsDisplayData()
    {
        var warningString = "";
        if (HasWarnings)
        {
            warningString += Issues.First(x => x.Name == "Warnings")
                .Groups.First()
                .Warnings.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return warningString;
    }
    public Field[] Issues { get; set; }

    public bool HasErrors
    {
        get
        {
            if (HasIssues)
            {
                return Issues.Any(x => x.Name == "Errors");
            }
            return false;
        }
    }

    public bool HasIssues
    {
        get
        {
            return Issues != null && Issues.Length > 0;
        }
    }

    public bool HasWarnings
    {
        get
        {
            if (HasIssues)
            {
                return Issues.Any(x => x.Name == "Warnings");
            }
            return false;
        }
    }

    public ResponseTags[] GetErrors()
    {
        if (HasErrors)
        {
            return Issues.First(x => x.Name == "Errors").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    public ResponseTags[] GetWarnings()
    {
        if (HasWarnings)
        {
            return Issues.First(x => x.Name == "Warnings").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    // For the display functions:
    // I don't understand why you only usses the first
    // groups of errors and warnings, but that may be a requirement.

    public string GetErrorsDisplayData()
    {
        var errorString = "";
        if (HasErrors)
        {
            errorString += Issues.First(x => x.Name == "Errors")
                .Groups.First()
                .Errors.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return errorString;
    }

    public string GetWarningsDisplayData()
    {
        var warningString = "";
        if (HasWarnings)
        {
            warningString += Issues.First(x => x.Name == "Warnings")
                .Groups.First()
                .Warnings.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return warningString;
    }
4 deleted 3 characters in body
source | link
    public Field[] Issues { get; set; }

    public bool HasErrors
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Errors");
            }
            return false;
        }
    }

    public bool HasNoIssuesHasIssues
    {
        get
        {
            return Issues ==!= null ||&& Issues.Length ==> 0;
        }
    }

    public bool HasWarnings
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Warnings");
            }
            return false;
        }
    }

    public ResponseTags[] GetErrors()
    {
        if (HasErrors)
        {
            return Issues.First(x => x.Name == "Errors").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    public ResponseTags[] GetWarnings()
    {
        if (HasWarnings)
        {
            return Issues.First(x => x.Name == "Warnings").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    // For the display functions:
    // I don't understand why you only usses the first
    // groups of errors and warnings, but that may be a requirement.

    public string GetErrorsDisplayData()
    {
        var errorString = "";
        if (HasErrors)
        {
            errorString += Issues.First(x => x.Name == "Errors")
                .Groups.First()
                .Errors.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return errorString;
    }

    public string GetWarningsDisplayData()
    {
        var warningString = "";
        if (HasWarnings)
        {
            warningString += Issues.First(x => x.Name == "Warnings")
                .Groups.First()
                .Warnings.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return warningString;
    }
    public Field[] Issues { get; set; }

    public bool HasErrors
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Errors");
            }
            return false;
        }
    }

    public bool HasNoIssues
    {
        get
        {
            return Issues == null || Issues.Length == 0;
        }
    }

    public bool HasWarnings
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Warnings");
            }
            return false;
        }
    }

    public ResponseTags[] GetErrors()
    {
        if (HasErrors)
        {
            return Issues.First(x => x.Name == "Errors").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    public ResponseTags[] GetWarnings()
    {
        if (HasWarnings)
        {
            return Issues.First(x => x.Name == "Warnings").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    // For the display functions:
    // I don't understand why you only usses the first
    // groups of errors and warnings, but that may be a requirement.

    public string GetErrorsDisplayData()
    {
        var errorString = "";
        if (HasErrors)
        {
            errorString += Issues.First(x => x.Name == "Errors")
                .Groups.First()
                .Errors.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return errorString;
    }

    public string GetWarningsDisplayData()
    {
        var warningString = "";
        if (HasWarnings)
        {
            warningString += Issues.First(x => x.Name == "Warnings")
                .Groups.First()
                .Warnings.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return warningString;
    }
    public Field[] Issues { get; set; }

    public bool HasErrors
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Errors");
            }
            return false;
        }
    }

    public bool HasIssues
    {
        get
        {
            return Issues != null && Issues.Length > 0;
        }
    }

    public bool HasWarnings
    {
        get
        {
            if (!HasNoIssues)
            {
                return Issues.Any(x => x.Name == "Warnings");
            }
            return false;
        }
    }

    public ResponseTags[] GetErrors()
    {
        if (HasErrors)
        {
            return Issues.First(x => x.Name == "Errors").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    public ResponseTags[] GetWarnings()
    {
        if (HasWarnings)
        {
            return Issues.First(x => x.Name == "Warnings").Groups.First().Warnings;
        }
        return new ResponseTags[0];
    }

    // For the display functions:
    // I don't understand why you only usses the first
    // groups of errors and warnings, but that may be a requirement.

    public string GetErrorsDisplayData()
    {
        var errorString = "";
        if (HasErrors)
        {
            errorString += Issues.First(x => x.Name == "Errors")
                .Groups.First()
                .Errors.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return errorString;
    }

    public string GetWarningsDisplayData()
    {
        var warningString = "";
        if (HasWarnings)
        {
            warningString += Issues.First(x => x.Name == "Warnings")
                .Groups.First()
                .Warnings.Aggregate("", (data, t) => data + t.Value + "\n");
        }
        return warningString;
    }
3 fixed small issue with the formatting
source | link
  • As Jesse said, I'd use Any instead of Where + Count. It should have a better performance, I think.
  • Properties are for me: HasNoIssues, HasWarnings and HasErrors
  • In my Opinion the rest should be methods
  • Issues.Where(x => x.Name == "Warnings").First() is the same as is the same as Issues.First(x => x.Name == "Warnings")
  • I changed the names of the functions (but it may be a matter of taste).
  • As Jesse said, I'd use Any instead of Where + Count. It should have a better performance, I think.
  • Properties are for me: HasNoIssues, HasWarnings and HasErrors
  • In my Opinion the rest should be methods
  • Issues.Where(x => x.Name == "Warnings").First() is the same as Issues.First(x => x.Name == "Warnings")
  • I changed the names of the functions (but it may be a matter of taste).
  • As Jesse said, I'd use Any instead of Where + Count. It should have a better performance, I think.
  • Properties are for me: HasNoIssues, HasWarnings and HasErrors
  • In my Opinion the rest should be methods
  • Issues.Where(x => x.Name == "Warnings").First() is the same as Issues.First(x => x.Name == "Warnings")
  • I changed the names of the functions (but it may be a matter of taste).
2 formatting and flow of answer improvements
source | link
1
source | link