How optimize by lambda expression

Posted by simply denis on Stack Overflow See other posts from Stack Overflow or by simply denis
Published on 2012-11-20T10:46:08Z Indexed on 2012/11/20 11:02 UTC
Read the original article Hit count: 193

Filed under:

I have a very similar function is only one previous report and the other future, how can I optimize and write beautiful?

public bool AnyPreviousReportByGroup(int groupID)
        {
            if(this.GroupID == groupID)
            {
                return true;
            }
            else
            {
                return PreviousReport.AnyPreviousReportByGroup(groupID);
            }
        }

        public bool AnyNextReportByGroup(int groupID)
        {

            if (this.GroupID == groupID)
            {
                return true;
            }
            else
            {
                return NextReport.AnyNextReportByGroup(groupID);
            }
        }

© Stack Overflow or respective owner

Related posts about c#