当前位置: 首页>>代码示例>>C#>>正文


C# ISeq.seq方法代码示例

本文整理汇总了C#中ISeq.seq方法的典型用法代码示例。如果您正苦于以下问题:C# ISeq.seq方法的具体用法?C# ISeq.seq怎么用?C# ISeq.seq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISeq的用法示例。


在下文中一共展示了ISeq.seq方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateInterface

        public static Type GenerateInterface(string iName, ISeq extends, ISeq methods)
        {
            GenContext context = new GenContext(iName, CompilerMode.File);

            //            GenContext context = (GenContext)Compiler.COMPILER_CONTEXT.deref();
            //            if (context == null)
            //            {
            //#if DEBUG
            //                context = new GenContext(iName, CompilerMode.File);
            //#else
            //                throw new InvalidOperationException("No compiler context on the stack.");
            //#endif
            //            }

            Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());

            TypeBuilder proxyTB = context.ModuleBldr.DefineType(
                iName,
                TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
                null,
                interfaceTypes);

            DefineMethods(proxyTB, methods);

            Type t = proxyTB.CreateType();
            context.AssyBldr.Save(iName  + ".dll");
            return t;
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:28,代码来源:GenInterface.cs

示例2: GenerateInterface

        public static Type GenerateInterface(string iName, IPersistentMap attributes, ISeq extends, ISeq methods)
        {
            iName = iName.Replace('-', '_');

            GenContext context;

            if (Compiler.IsCompiling)
            {
                //string path = (string)Compiler.COMPILE_PATH.deref();
                //if (path == null)
                //    throw new Exception("*compile-path* not set");
                //context = new GenContext(iName, ".dll", path, CompilerMode.File);
                context = (GenContext)Compiler.COMPILER_CONTEXT.deref();
            }
            else
                // TODO: In CLR4, should create a collectible type?
                context = GenContext.CreateWithExternalAssembly(iName, ".dll", false);

            Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());

            TypeBuilder proxyTB = context.ModuleBuilder.DefineType(
                iName,
                TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
                null,
                interfaceTypes);

            SetCustomAttributes(proxyTB, attributes);

            DefineMethods(proxyTB, methods);

            Type t = proxyTB.CreateType();

            //if ( Compiler.IsCompiling )
            //    context.SaveAssembly();

            Compiler.RegisterDuplicateType(t);

            return t;
        }
开发者ID:davidadsit,项目名称:clojure-clr,代码行数:39,代码来源:GenInterface.cs

示例3: DefineMethods

 private static void DefineMethods(TypeBuilder proxyTB, ISeq methods)
 {
     for (ISeq s = methods == null ? null : methods.seq(); s != null; s = s.next())
         DefineMethod(proxyTB, (IPersistentVector)s.first());
 }
开发者ID:davidadsit,项目名称:clojure-clr,代码行数:5,代码来源:GenInterface.cs

示例4: CreateTypeArray

        internal static Type[] CreateTypeArray(ISeq seq)
        {
            List<Type> types = new List<Type>();

            for (ISeq s = seq == null ? null : seq.seq(); s != null; s = s.next())
            {
                Object o = s.first();
                Type oAsType = o as Type;
                if (oAsType != null )
                    types.Add(oAsType);
                else if (o is ISeq)
                {
                    object first = RT.first(o);
                   Symbol firstAsSymbol = first as Symbol;
                    if (firstAsSymbol == null || !firstAsSymbol.Equals(HostExpr.ByRefSym))
                        throw new ArgumentException("First element of parameter definition is not by-ref");

                    Type secondAsType = RT.second(o) as Type;

                    if (secondAsType == null)
                        throw new ArgumentException("by-ref must be paired with a type");

                    types.Add(secondAsType.MakeByRefType());
                }
                else
                    throw new ArgumentException("Bad parameter definition");
            }

            if ( types.Count ==  0 )
                return Type.EmptyTypes;

            return types.ToArray<Type>();
        }
开发者ID:ragnard,项目名称:clojure-clr,代码行数:33,代码来源:GenClass.cs

示例5: CreateTypeArray

        internal static Type[] CreateTypeArray(ISeq seq)
        {
            List<Type> types = new List<Type>();

            for (ISeq s = seq == null ? null : seq.seq(); s != null; s = s.next())
            {
                Object o = s.first();
                if (o is Type)
                    types.Add((Type)o);
                else if (o is ISeq)
                {
                    object first = RT.first(o);
                    object second = RT.second(o);
                    if (!(first is Symbol) || !((Symbol)first).Equals(HostExpr.BY_REF))
                        throw new ArgumentException("First element of parameter definition is not by-ref");
                    if (!(second is Type))
                        throw new ArgumentException("by-ref must be paired with a type");
                    Type t = (Type)second;
                    types.Add(t.MakeByRefType());
                }
                else
                    throw new ArgumentException("Bad parameter definition");
            }

            if ( types.Count ==  0 )
                return Type.EmptyTypes;

            return types.ToArray<Type>();
        }
开发者ID:101v,项目名称:clojure-clr,代码行数:29,代码来源:GenClass.cs

示例6: CreateTypeArray

        internal static Type[] CreateTypeArray(ISeq seq)
        {
            List<Type> types = new List<Type>();

            for (ISeq s = seq == null ? null :seq.seq(); s != null; s = s.next())
                types.Add((Type)s.first());

            if ( types.Count ==  0 )
                return Type.EmptyTypes;

            return types.ToArray<Type>();
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:12,代码来源:GenClass.cs


注:本文中的ISeq.seq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。