This project is read-only.

Does you has generic operator plan support?

Apr 6, 2012 at 9:12 AM

just like :

var q = new System::Collections::Generic::List<string>();



only can invoke .net method, not implelementation in your class.

I  needed it .  thanks.

Apr 9, 2012 at 2:21 PM
Edited Apr 9, 2012 at 2:27 PM

At this time, i'm still trying to add generic types (and generic operations) support to AddyScript.

This requires defining a suitable syntax and an efficient handling mechanism for it at runtime.

As soon as those two prerequisites will be statisfied, it will become possible to use .Net generic types from AddyScript.

While waiting, please be patient.

Apr 10, 2012 at 7:00 AM
Edited Apr 11, 2012 at 3:10 AM

Very thank's.  I can write other code instead. 

another question is :

If a .net class implements not standard or partial IConvertable ( I used a nosql daatbase driver  class: MongoDB.Bson.BsonElement or MongoDB.Bson.BsonValue ).

When i create a BsonElement use BsonValue as param, it will report Convert Error  .

in Runtime\Dynamics\Resource.cs :

 public override object ConvertTo(Type targetType)
        {            return handle is IConvertible
                ? ((IConvertible)handle).ToType(targetType, CultureInfo.InvariantCulture)
                : base.ConvertTo(targetType);

 Need check a NativeObject.classType eq targetType , or NativeObject class is targetType class  children.

this is i changed code for reference(this code not check interface ,just class  ):

           Type myType = handle.GetType();
            if (myType.IsClass && targetType.IsClass && this.NativeType.IsClass && ((myType == targetType) || myType.IsSubclassOf(targetType)))
                return handle;
            return handle is IConvertible
                ? ((IConvertible)handle).ToType(targetType, CultureInfo.InvariantCulture)
                : base.ConvertTo(targetType);

Apr 10, 2012 at 7:08 AM
Edited Apr 10, 2012 at 7:31 AM


this is class define:

public abstract class BsonValue : IComparable<BsonValue>,
IConvertible, IEquatable<BsonValue>

public class BsonElement : IComparable<BsonElement>,

this is sample code:

var docs = new MongoDB::Bson::BsonDocument();  
  var value =  MongoDB::Bson::BsonValue::Create("aaa");
  var elem = MongoDB::Bson::BsonElement::Create("Name", value);   // this line report error : can't convert System::String to  MongoDB::Bson::BsonValue

Apr 11, 2012 at 4:58 PM

Thanks for your suggestion on Resource.ConvertTo. Checking that the target type is the same than the original type is absolutely necessary and avoids useless conversion.

Now, for the error message, it's simply that AddyScript cannot convert a string to an instance of BsonValue. I don't know the proptotype of MongoDB.Bson.BsonElement.Create but it seems that at least one argument is not of the right type.

Apr 17, 2012 at 3:14 AM


    MongoDB.Bson.BsonElement.Create is  a static create factory, in this line, it's return  a BsonElement,   BsonDocument managered a BsonElement array.

BsonValue::Create("aaa") real return a BsonString , is a BsonValue Child.


        List<BsonElement> Elements;

  BsonElement :

        string Name;

        BsonValue Value;

BsonValue  like  a  ValueType object ,can store some baseType , it children impl it's action. BsonString store string, BsonBool store bool, BsonDateTime store datetime.

very thank you.