Advertisement
ivandrofly

Subtitle Edit: Renumber

Jul 21st, 2023
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. ====== current
  2.  
  3. public void Renumber(int startNumber = 1)
  4. {
  5.     var number = startNumber;
  6.     int l = Paragraphs.Count + number;
  7.     while (number < l)
  8.     {
  9.         var p = Paragraphs[number - startNumber];
  10.         p.Number = number++;
  11.     }
  12. }
  13.  
  14. ====== ai generated
  15.  
  16. public void Renumber(int startNumber = 1)
  17. {
  18.     var totalParagraphs = Paragraphs.Count + startNumber;
  19.  
  20.     for (int i = 0; startNumber < totalParagraphs; i++, startNumber++)
  21.     {
  22.         var paragraph = Paragraphs[i];
  23.         paragraph.Number = startNumber;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement