Revit API

Revit API

Reply
Contributor
mostafa90
Posts: 24
Registered: ‎06-18-2009
Message 1 of 2 (88 Views)

Application.new referenceArray Vs ReferenceArray?

88 Views, 1 Replies
02-08-2014 10:59 AM

i recently discovered that there are two Reference Arrays in the API,

the 1st:

ReferenceArray rArr = new ReferenceArray;

 

and the second:

Reference Array rArr = m_doc.Application.Create.NewReferenceArray();

 

Can any one inlight me what is the difference?

Mentor
Scott_Wilson
Posts: 190
Registered: ‎04-10-2013
Message 2 of 2 (65 Views)

Re: Application.new referenceArray Vs ReferenceArray?

02-08-2014 10:38 PM in reply to: mostafa90

The simple answer is that there isn't is any difference at all. Many, if not all of the "New*' prefixed methods found in the Autodesk.Revit.Creation.Application class have either long existing or recently added equivalent constructor methods found within the class objects they return. Some of them are now becomming obsolete (NewLine, NewLineBound and NewLineUnbound for instance), which says to me that Autodesk are moving away from the monolithic factory class pattern in favour of localised factory methods and constructors. Which in my opinion is a very good thing.

 

To save yourself work in the future (See NewLine etc.) I'd go with the in-class constructor / factory method over the Creation.Application methods where possible. If someone more in the know has a differing view, then I am quite happy to be corrected.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.