Generic array

Dejan Lekic dejan.lekic at gmail.com
Wed Nov 16 00:33:04 PST 2011


RenatoL wrote:

> ##[3] arr = [0, "aa", 2.4];
> 
> What can i put instead of ##?
> 
> In C#, just for example, i can write:
> 
> object[] ar1 = new object[3];
> ar1[0] = 1;
> ar1[1] = "hello";
> ar1[2] = 'a';
> 
> and it works. But in D
> 
> Object[3] arr0 = [0, "aa", 2.4];
> 
> and  compiler complains....

In D, the equivalent would be:

Variant[] arr = variantArray(0, "aa", 2.4);


More information about the Digitalmars-d-learn mailing list