Casting - Definition

Casting - Definition

J33C316
Advocate Advocate
884 Views
2 Replies
Message 1 of 3

Casting - Definition

J33C316
Advocate
Advocate

Newbie question... Can someone help me to understand casting? I've been through the tutorials but still don't have a grip on it. Thanks.

0 Likes
Accepted solutions (1)
885 Views
2 Replies
Replies (2)
Message 2 of 3

Sean_Page
Collaborator
Collaborator
Accepted solution

https://www.w3schools.com/cs/cs_type_casting.asp

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 3 of 3

RPTHOMAS108
Mentor
Mentor

I saw this the other week but maybe from below more will understand a specific benefit of not casting:

 

Element.Name = Read/Write property

ElementType.Name = WriteOnly property

 

Everything that then inherits from ElementType e.g. FamilySymbol gets the same limited property access.

 

Would also suggest overriding .ToString with Name since .ToString is  the final fall back in WPF binding. Suggestion as idea added below.

 

https://forums.autodesk.com/t5/revit-ideas/revit-api-override-tostring-with-element-name/idi-p/96584...

0 Likes