# Extends is genial

**URL:** <https://forum.xojo.com/t/extends-is-genial/84651>\
**Category:** General\
**Created:** [March 21, 2025, 2:15pm UTC](https://forum.xojo.com/t/extends-is-genial/84651 "2025-03-21T14:15:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_Luc\_Pellerin](https://forum.xojo.com/user_avatar/forum.xojo.com/j_luc_pellerin/32/18744_2.png) [@J\_Luc\_Pellerin](https://forum.xojo.com/u/J_Luc_Pellerin)\
**Post date:** [March 21, 2025, 2:15pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/1 "2025-03-21T14:15:05Z")

</div>

Hello everyone I do not come to ask a question but to share with you my joy of having found a great feature: “Extends”

For example, I want to place entetes on a box list.  
Before doing this:

```auto
listeBox.HeaderAt ( 01 ) = "AA"
listeBox.HeaderAt ( 02 ) = "BB" 
listeBox.HeaderAt ( 03 ) = "CC" 
listeBox.HeaderAt ( 04 ) = "DD"

```

and now :

> listeBox.headers ( “AA,BB,CC,DD” )

```auto
Here is the headers method placed in a module:
Var col As Integer
Var headers() As String

headers = L_headers.ToArray ( "," )
col = 0
For Each h As String In headers
  If col <= ListBox.LastColumnIndex Then
         ListBox.HeaderAt ( col ) = h
  Else
         ListBox.HeaderAt ( col ) = ""
  End If
  col = col + 1
Next

Exception err
Break
End Sub

```

And then for a dictionnary

```auto
Function listeKeys(Extends dico As Dictionary) As string
' Permet d'obtenir une liste des key cle01,cle02... d un dictionnaire

For Each de As DictionaryEntry In dico
  If tx_keys = "" Then
    tx_keys = tx_keys + de.Key.StringValue
  Else
    tx_keys = tx_keys + " , " + de.Key.StringValue
  End If 
Next

Return tx_keys

```

`

> var liste as string = Un\_Dico. listeKeys

`

---

<div class="post-metadata">

**Author:** ![Scott\_C](https://forum.xojo.com/user_avatar/forum.xojo.com/scott_c/32/19612_2.png) [@Scott\_C](https://forum.xojo.com/u/Scott_C)\
**Post date:** [March 21, 2025, 4:13pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/2 "2025-03-21T16:13:06Z")

</div>

> [@J\_Luc\_Pellerin](#):
>
> share with you my joy of having found a great feature: “Extends”

Yes, it’s a great language feature. By using the `Extends` modifier, you’re creating what is known as an “Extension Method”.

Because it appears you’re using a number of arguments with it, are you also using the [ParamArray](https://documentation.xojo.com/api/language/paramarray.html#paramarray) modifier to make the number of arguments dynamic? Also a great feature 😊

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [March 21, 2025, 5:08pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/3 "2025-03-21T17:08:18Z")

</div>

> [@J\_Luc\_Pellerin](#):
>
> `tx_keys `

this variable tx\_keys seems outside of the method or you removed this line.

i agree this Extends is very useful.

FromArray is nice no make a csv list, unfortunately not for variant arrays.

```auto
Var d As New Dictionary("left" : 0, "top" : 10, "width" : 300, "height" : 300)

Var k() As String
For Each de As DictionaryEntry In d
  k.Add de.Key.StringValue
Next

System.DebugLog String.FromArray(k, ",")

```

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [March 21, 2025, 5:08pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/4 "2025-03-21T17:08:21Z")

</div>

Interestingly, to reference another thread, the French word “genial “ does not translate to the English word “genial “.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [March 21, 2025, 5:22pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/5 "2025-03-21T17:22:22Z")

</div>

But, I knew what @J_Luc_Pellerin meant and I agree.

---

<div class="post-metadata">

**Author:** ![J\_Luc\_Pellerin](https://forum.xojo.com/user_avatar/forum.xojo.com/j_luc_pellerin/32/18744_2.png) [@J\_Luc\_Pellerin](https://forum.xojo.com/u/J_Luc_Pellerin)\
**Post date:** [March 21, 2025, 5:38pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/6 "2025-03-21T17:38:29Z")

</div>

> [@MarkusR](#):
>
> this variable tx\_keys seems outside of the method or you removed this line.

I mistake a ligne  
var tx\_keys as string

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [March 22, 2025, 3:34pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/7 "2025-03-22T15:34:01Z")

</div>

This method might also benefit from ParamArray:

```xojo
Sub Headers (Extends List As DesktopListBox, ParamArray Columns() As String)

```

Then you do

```xojo
List.Headers("AA", "BB", "CC", "DD")

```

---

<div class="post-metadata">

**Author:** ![J\_Luc\_Pellerin](https://forum.xojo.com/user_avatar/forum.xojo.com/j_luc_pellerin/32/18744_2.png) [@J\_Luc\_Pellerin](https://forum.xojo.com/u/J_Luc_Pellerin)\
**Post date:** [March 24, 2025, 12:20pm UTC](https://forum.xojo.com/t/extends-is-genial/84651/8 "2025-03-24T12:20:56Z")

</div>

Yes Thanck you for your reply
