Exemple #1
0
        protected CodeRoot CreateIndexer(string parameterName)
        {
            Indexer inter = new Indexer(controller);

            inter.Name     = "File";
            inter.DataType = new DataType(controller, "int");
            Parameter param = new Parameter(controller);

            param.Name     = parameterName;
            param.DataType = "int";
            inter.Parameters.Add(param);

            PropertyAccessor acc = new PropertyAccessor(controller);

            acc.Modifier     = "public";
            acc.BodyText     = "{ return file[i]; }";
            acc.AccessorType = PropertyAccessor.AccessorTypes.Get;
            inter.AddChild(acc);

            acc              = new PropertyAccessor(controller);
            acc.Modifier     = "protected";
            acc.BodyText     = "{ file[i] = value; }";
            acc.AccessorType = PropertyAccessor.AccessorTypes.Set;
            inter.AddChild(acc);

            return(CreateClassAndNamespace(inter));
        }