One of the goals for us is to make programmers using Aspose.Editor feel at home and enjoy using our component. One of the authorities for the Aspose.Editor development team was the Framework Design Guidelines book by Krzysztof Cwalina and Brad Abrams.
For example, we debated for long time whether to keep Range as a property of Document as in Microsoft Word Automation, or turn it into a GetRange() method. On the one hand we wanted to keep the API similar to Microsoft Word, but on the other hand, the Document.Range property always creates a new Range object.
We decided to step away from Document.Range to Document.GetRange(). This made things a lot more self-explanatory and easier, because a property that creates a new object every time it is accessed is not good from the modern .NET development point of view.
When coding with Microsoft Word Automation you can write code that makes no sense:
Document.Range.Start = 5
The above line of code is really confusing because it does not change the document to start from character 5. What it does is create a new Range object for the entire document and then changes the Start property of that range to be 5. Then, it discards the Range object because there are no other references to it.
When coding with Aspose.Editor, there is no confusion, the public API is self documenting:
Range range = doc.GetRange();
range.Start = 5;
Yet, when you consider Selection.Range, then modify the range, it actually modifies the selection. In this case we kept the Selection.Range property.
This code works and looks the same in both Microsoft Word Automation and in Aspose.Editor (it modifies the start of the selection):
Selection.Range.Start = 5