# Element.ToString input

**URL:** <https://forum.dynamobim.com/t/element-tostring-input/105424>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [October 28, 2024, 3:17am UTC](https://forum.dynamobim.com/t/element-tostring-input/105424 "2024-10-28T03:17:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jin](https://forum.dynamobim.com/u/Jin)\
**Post date:** [October 28, 2024, 3:17am UTC](https://forum.dynamobim.com/t/element-tostring-input/105424/1 "2024-10-28T03:17:46Z")

</div>

What is the formatProvider input for this node? Could you give me an example for it?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/a/fa04358163d618181ebff288c641ea46dd01a633.png)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [October 28, 2024, 9:22am UTC](https://forum.dynamobim.com/t/element-tostring-input/105424/2 "2024-10-28T09:22:37Z")

</div>

Hey,

A lot of Revit API calls allow ‘ToString’, this node is an alternative to ‘String from Object’ but allows extra control of the output.

Unfortunately it appears not to have any documentation, it is also not clear which nodes might output an ‘iformatProvider’. IformatProviders cannot be constructed in Cpython3 either.

I think this has probably not been resolved because everyone just uses String from Object.

For myself, it would be most useful to control ‘format’ with something like DateTime, but it’s rare to get that from an Element, which is why I’ve not used it?

Feel free to chase on github…

> <https://github.com/DynamoDS/DynamoDictionary/issues/17>
>
> Needs a sample graph. Gonna be honest. I don't know what this node does.
> !\[tost…ring\](https://user-images.githubusercontent.com/15744724/49660796-b3e8ed00-fa04-11e8-8202-ded9c50018f5.jpg)

> <https://github.com/DynamoDS/DynamoRevit/blob/master/src/Libraries/RevitNodes/Elements/Element.cs#L352>

Hope that is useful,

Mark

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [October 28, 2024, 10:49am UTC](https://forum.dynamobim.com/t/element-tostring-input/105424/3 "2024-10-28T10:49:22Z")

</div>

Not an expert on this particular implementation (as we don’t need to use it), but I’ll peel back some of the onion layers for everyone.

First up we can identify the object type IFormatProvider. This is a .net class used to control how stuff is displayed when localized. The MS article on the class is likely the best example to learn from: [https://learn.microsoft.com/en-us/dotnet/api/system.iformatprovider?view=net-8.0](https://learn.microsoft.com/en-us/dotnet/api/system.iformatprovider?view=net-8.0)

Now onto Dynamo’s use of the method. My belief is that Dynamo for Revit uses this internally in it’s ToString method to convert things in a meaningful way for use in display - specifically you can see how it’s managing the application of the method override for XYZ points here: [DynamoRevit/src/Libraries/RevitNodes/Elements/ReferencePoint.cs at 8f79cc7d20db8488a9be4118080933c7bd860eb6 · DynamoDS/DynamoRevit · GitHub](https://github.com/DynamoDS/DynamoRevit/blob/8f79cc7d20db8488a9be4118080933c7bd860eb6/src/Libraries/RevitNodes/Elements/ReferencePoint.cs#L495).

Which finally brings us to ‘why is it exposed to users?’. The answer of which is "I have no idea, but since it doesn’t break anything and is really just there to control how ‘ToString’ works for various elements which are unique to Revit. It maybe that it should be ‘hidden’ in the Dynamo library, but as this is \>6 years old, doing so now might break someone’s workflow (as these nodes can be called in conjunction with custom nodes that provide the IFormatProvider as one example). However as I haven’t seen or heard of anyone using this, I’ll log an issue on the Dynamo for Revit GitHub incase this is causing confusion.

**Edit** The GitHub issue for reference is here: [ELement.ToString node has non-functional inputs · Issue #3107 · DynamoDS/DynamoRevit · GitHub](https://github.com/DynamoDS/DynamoRevit/issues/3107)

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [October 29, 2024, 7:10am UTC](https://forum.dynamobim.com/t/element-tostring-input/105424/4 "2024-10-29T07:10:12Z")

</div>

Workaround 😉

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/7/773a8d2710813bb8cc582986ed57394e805fc0a7.png)

---

<div class="post-metadata">

**Author:** ![Jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jin](https://forum.dynamobim.com/u/Jin)\
**Post date:** [November 5, 2024, 10:27am UTC](https://forum.dynamobim.com/t/element-tostring-input/105424/5 "2024-11-05T10:27:44Z")

</div>

Why do we need inputs for null?

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 5, 2024, 12:45pm UTC](https://forum.dynamobim.com/t/element-tostring-input/105424/6 "2024-11-05T12:45:04Z")

</div>

You don’t - just use String.FromObject, which wraps adds the functions of this node with the format and format provider. They cannot be accurately provided in the UI as currently designed.
