How to use Team Foundation's library to calculate unified diff?

前端 未结 2 2170
不知归路
不知归路 2021-02-19 16:17

I want to calculate a unified diff comparing two documents. (The diff is to go in an email, and Wikipedia says unified diff is the best plain text diff format.)

Team Fo

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 16:58

    Please try DiffSegment

            var diff = Difference.DiffFiles(
            before, FileType.Detect(before, null),
            after, FileType.Detect(after, null),
            options);
    
            while (diff != null){                
                //DO What you like with the diff(s)
                diff = diff.Next;
            }
    

提交回复
热议问题