private bool AddMember( List <FormattedMember> members, FormattedMember member, ref int remainingLength ) { // Add this item even if we exceed the limit - its prefix might be appended to the result. members.Add(member); // We don't need to calculate an exact length, just a lower bound on the size. // We can add more members to the result than it will eventually fit, we shouldn't add less. // Add 2 more, even if only one or half of it fit, so that the separator is included in edge cases. if (remainingLength == int.MinValue) { return(false); } remainingLength -= member.MinimalLength; if (remainingLength <= 0) { remainingLength = int.MinValue; } return(true); }
private bool AddMember(List<FormattedMember> members, FormattedMember member, ref int remainingLength) { // Add this item even if we exceed the limit - its prefix might be appended to the result. members.Add(member); // We don't need to calculate an exact length, just a lower bound on the size. // We can add more members to the result than it will eventually fit, we shouldn't add less. // Add 2 more, even if only one or half of it fit, so that the separator is included in edge cases. if (remainingLength == Int32.MinValue) { return false; } remainingLength -= member.MinimalLength; if (remainingLength <= 0) { remainingLength = Int32.MinValue; } return true; }