• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RubyArray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RubyArray的典型用法代码示例。如果您正苦于以下问题:C# RubyArray类的具体用法?C# RubyArray怎么用?C# RubyArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RubyArray类属于命名空间,在下文中一共展示了RubyArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: dosync

        public static object dosync(RubyModule/*!*/ self, RubyArray args)
        {
            object res = null;
            try
            {
                boolean bShowStatus = true;	
                String query_params = "";
                if ( args != null && args.Count > 0 )	
                {
                    String str = ((MutableString)args[0]).ToString();	
                    //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);	
                    bShowStatus = "true".equalsIgnoreCase(str);	
                }
        
                if (args != null && args.Count > 1)
                    query_params = ((MutableString)args[1]).ToString();
                
                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, bShowStatus, query_params));

                res = SyncThread.getInstance().getRetValue();
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("dosync", ex);
                throw rubyEx;
            }

            return res;
        }
开发者ID:javiermurillo,项目名称:rhodes,代码行数:34,代码来源:RhoSyncEngine.cs


示例2: CreateBacktrace

        // Called lazily to create a Ruby backtrace.
        private void CreateBacktrace() {
            RubyArray result;

            int skipFrames = 0;
            bool hasFileAccessPermissions = DetectFileAccessPermissions();

#if SILVERLIGHT // TODO: StackTrace.ctor(exception) security critical
            // throw-site trace is built already:
            result = _backtrace ?? new RubyArray();
#else
            result = new RubyArray();
            if (_throwSiteTrace == null) {
                SetCompiledTrace();
            }

            AddBacktrace(result, _throwSiteTrace.GetFrames(), hasFileAccessPermissions, skipFrames);
#endif
            if (_catchSiteTrace != null) {
                // skip one frame - the catch-site frame is already included
                AddBacktrace(result, _catchSiteTrace.GetFrames(), hasFileAccessPermissions, 1);
            }

            _backtrace = result;
            _backtraceInitialized = true;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:26,代码来源:RubyExceptionData.cs


示例3: GetMembers

 internal RubyArray/*!*/ GetMembers() {
     RubyArray list = new RubyArray(Members.Length);
     foreach (string id in Members) {
         list.Add(MutableString.Create(id));
     }
     return list;
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:7,代码来源:RubyStruct.cs


示例4: RhoParamArray

 public RhoParamArray(RhoParams oParams, String name) : base(oParams)
 {
     m_array = null;
     Object ar = findHashParam(name);
     if (ar != null && (ar is RubyArray))
         m_array = (RubyArray)ar;    
 }
开发者ID:arissetyawan,项目名称:rhodes,代码行数:7,代码来源:RhoParamArray.cs


示例5: GetMembers

 internal RubyArray/*!*/ GetMembers(RubyContext/*!*/ context) {
     RubyArray list = new RubyArray(_names.Length);
     foreach (string id in _names) {
         list.Add(context.StringifyIdentifier(id));
     }
     return list;
 }
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:7,代码来源:RubyStruct.cs


示例6: Script

 public Script(RubyArray rmScript)
 {
     _rmScript = rmScript;
       _section = (int)_rmScript[0];
       _name = Ruby.ConvertString((MutableString)_rmScript[1]);
       UpdateTabName();
 }
开发者ID:revam,项目名称:Gemini,代码行数:7,代码来源:Script.cs


示例7: ToYamlNode

 public static Node ToYamlNode(RubyContext/*!*/ context, RubyArray/*!*/ self, [NotNull]RubyRepresenter/*!*/ rep)
 {
     return rep.Sequence(
         rep.GetTagUri(self, Tags.Seq, typeof(RubyArray)),
         self,
         rep.GetYamlStyle(self) != ScalarQuotingStyle.None ? FlowStyle.Inline : FlowStyle.Block
     );
 }
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:BuiltinsOps.cs


示例8: GetMembers

 internal RubyArray/*!*/ GetMembers() {
     RubyArray list = new RubyArray(_names.Length);
     foreach (string id in _names) {
         // TODO: we need to add encoding to symbols and preserve it here:
         list.Add(MutableString.Create(id, RubyEncoding.UTF8));
     }
     return list;
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:8,代码来源:RubyStruct.cs


示例9: Create

        public static void Create(RubyModule/*!*/ self, int barType, RubyArray args)
        {
            if (args != null && args.Count > 0)
                RhodesApp.createToolBar(barType, (Object)args);

            if (barType == 2)
                RhodesApp.removeToolBar();
        }
开发者ID:douglaslise,项目名称:rhodes,代码行数:8,代码来源:RhoNativeBar.cs


示例10: Execute

            public static RubyArray Execute(RhoDatabase/*!*/ self, MutableString/*!*/ sqlStatement, Boolean isBatch, RubyArray args)
            {
                try
                {
                    RubyArray retArr = new RubyArray();

                    if (isBatch)
                    {
                        self.m_db.executeBatchSQL(sqlStatement.ToString());
                    }
                    else
                    {
                        Object[] values = null;
                        if (args != null && args.Count > 0)
                        {
                            if (args[0] != null && args[0] is RubyArray)
                                values = ((RubyArray)args[0]).ToArray();
                            else
                                values = args.ToArray();
                        }

                        try
                        {
                            self.m_db.Lock();
                            using (IDBResult rows = self.m_db.executeSQL(sqlStatement.ToString(), values, true))
                            {
                                if (rows != null)
                                {
                                    MutableString[] colNames = null;
                                    for (; !rows.isEnd(); rows.next())
                                    {
                                        IDictionary<object, object> map = new Dictionary<object, object>();
                                        Hash row = new Hash(map);
                                        for (int nCol = 0; nCol < rows.getColCount(); nCol++)
                                        {
                                            if (colNames == null)
                                                colNames = getOrigColNames(rows);

                                            row.Add(colNames[nCol], rows.getRubyValueByIdx(nCol));
                                        }
                                        retArr.Add(row);
                                    }
                                }
                            }
                        }
                        finally
                        {
                            self.m_db.Unlock();
                        }
                    }

                    return retArr;
                }catch (Exception exc)
                {
                    //TODO: throw ruby exception
                    throw exc;
                }
            }
开发者ID:Chanic,项目名称:rhodes,代码行数:58,代码来源:RhoDatabase.cs


示例11: Accept

 public static RubyArray Accept(RubyContext/*!*/ context, RubySocket/*!*/ self)
 {
     RubyArray result = new RubyArray(2);
     RubySocket s = new RubySocket(context, self.Socket.Accept());
     result.Add(s);
     SocketAddress addr = s.Socket.RemoteEndPoint.Serialize();
     result.Add(MutableString.CreateAscii(addr.ToString()));
     return result;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:9,代码来源:Socket.cs


示例12: destroyTables

            public static void destroyTables(RhoDatabase/*!*/ self, RubyArray arInclude, RubyArray arExclude)
            {
                Vector<String> vecIncludes = RhoRuby.makeVectorStringFromArray(arInclude);
                Vector<String> vecExcludes = RhoRuby.makeVectorStringFromArray(arExclude);

                self.m_db.rb_destroy_tables(vecIncludes, vecExcludes);

                //throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
                //TODO: threw ruby exception

            }
开发者ID:Chanic,项目名称:rhodes,代码行数:11,代码来源:RhoDatabase.cs


示例13: GetGroup

        public static RubyArray GetGroup(RubyContext/*!*/ context, MatchData/*!*/ self, [DefaultProtocol]int start, [DefaultProtocol]int length) {
            if (!IListOps.NormalizeRange(self.Groups.Count, ref start, ref length)) {
                return null;
            }

            RubyArray result = new RubyArray();
            for (int i = 0; i < length; i++) {
                result.Add(self.GetGroupValue(context, start + i));
            }

            return result;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:12,代码来源:MatchDataOps.cs


示例14: List

        public static RubyArray/*!*/ List([NotNull]ThreadGroup/*!*/ self) {
            ThreadOps.RubyThreadInfo[] threads = ThreadOps.RubyThreadInfo.Threads;
            RubyArray result = new RubyArray(threads.Length);
            foreach (ThreadOps.RubyThreadInfo threadInfo in threads) {
                Thread thread = threadInfo.Thread;
                if (thread != null && threadInfo.Group == self) {
                    result.Add(thread);
                }
            }

            return result;
        }
开发者ID:jschementi,项目名称:iron,代码行数:12,代码来源:ThreadGroup.cs


示例15: DefineFinalizer

        public static object DefineFinalizer(RespondToStorage/*!*/ respondTo, BinaryOpStorage/*!*/ call, RubyModule/*!*/ self, object obj, object finalizer)
        {
            if (!Protocols.RespondTo(respondTo, finalizer, "call")) {
                throw RubyExceptions.CreateArgumentError("finalizer should be callable (respond to :call)");
            }

            respondTo.Context.SetInstanceVariable(obj, FinalizerInvoker.InstanceVariableName, new FinalizerInvoker(call.GetCallSite("call"), finalizer));
            RubyArray result = new RubyArray(2);
            result.Add(0);
            result.Add(finalizer);
            return result;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:12,代码来源:ObjectSpace.cs


示例16: Map

 public static RubyArray Map(RubyContext/*!*/ context, BlockParam collector, object self) {
     RubyArray result = new RubyArray();
     Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) {
         if (collector != null) {
             if (collector.Yield(item, out item)) {
                 return item;
             }
         }
         result.Add(item);
         return null;
     }));
     return result;
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:13,代码来源:Enumerable.cs


示例17: TOA

        public static RubyArray/*!*/ TOA(RubyContext/*!*/ context, object self) {
            RubyArray result = new RubyArray();
            RubyArray lines;

            while (context.InputProvider.HasMoreFiles()) {
                lines = RubyIOOps.ReadLines(context, context.InputProvider.GetOrResetCurrentStream());
                //TODO: result.append(lines)???
                foreach (var line in lines) {
                    result.Add(line);
                }
            }
            return result;
        }
开发者ID:rudimk,项目名称:dlr-dotnet,代码行数:13,代码来源:ArgFilesSingletonOps.cs


示例18: Map

 public static RubyArray Map(CallSiteStorage<EachSite>/*!*/ each, BlockParam collector, object self) {
     RubyArray result = new RubyArray();
     Each(each, self, Proc.Create(each.Context, delegate(BlockParam/*!*/ selfBlock, object _, object item) {
         if (collector != null) {
             if (collector.Yield(item, out item)) {
                 return item;
             }
         }
         result.Add(item);
         return null;
     }));
     return result;
 }
开发者ID:Hank923,项目名称:ironruby,代码行数:13,代码来源:Enumerable.cs


示例19: GetAvailableEncodings

        public static RubyArray/*!*/ GetAvailableEncodings(RubyClass/*!*/ self) {
            // TODO: loads all encodings, we should be lazy with encoding creation

            var infos = Encoding.GetEncodings();
            var result = new RubyArray(1 + infos.Length);

            // Ruby specific:
            result.Add(RubyEncoding.Binary);

            foreach (var info in infos) {
                result.Add(RubyEncoding.GetRubyEncoding(info.GetEncoding()));
            }
            return result;
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:14,代码来源:RubyEncodingOps.cs


示例20: RubyArray_Add

        public void RubyArray_Add()
        {
            RubyArray a;
            a = new RubyArray();

            for (int i = 0; i < Utils.MinListSize; i++) {
                a.Add(i);
                Assert((int)a[i] == i && a.Count == i + 1 && a.Capacity == Utils.MinListSize);
            }

            Assert(((IList)a).Add(Utils.MinListSize) == Utils.MinListSize);
            Assert(a.Count == Utils.MinListSize + 1);
            for (int i = 0; i < a.Count; i++) {
                Assert((int)a[i] == i);
            }

            a = new RubyArray(new[] { 1,2,3 });
            a.AddCapacity(0);
            Assert(a.Count == 3);
            a.AddCapacity(100);
            Assert(a.Count == 3 && a.Capacity >= 103);

            a = new RubyArray(new[] { 1, 2, 3 });
            a.AddMultiple(0, 4);
            AssertValueEquals(a, 1, 2, 3);
            a.AddMultiple(5, 4);
            AssertValueEquals(a, 1, 2, 3, 4, 4, 4, 4, 4);

            a = new RubyArray(new[] { 1, 2, 3 });
            a.AddRange(new object[0]);
            AssertValueEquals(a, 1, 2, 3);
            a.AddRange(new[] { 4 });
            AssertValueEquals(a, 1, 2, 3, 4);
            a.AddRange(new[] { 5, 6, 7, 8, 9, 10 });
            AssertValueEquals(a, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
            a.AddRange(new[] { 11 });
            AssertValueEquals(a, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);

            a = new RubyArray();
            a.AddRange((IEnumerable)new RubyArray(new[] { 1, 2, 3 }));
            a.AddRange((IList)new RubyArray(new[] { 1, 2, 3 }), 1, 2);
            AssertValueEquals(a, 1, 2, 3, 2, 3);

            a.Freeze();
            AssertExceptionThrown<RuntimeError>(() => a.Add(1));
            AssertExceptionThrown<RuntimeError>(() => a.AddCapacity(10));
            AssertExceptionThrown<RuntimeError>(() => a.AddMultiple(10, 10));
            AssertExceptionThrown<RuntimeError>(() => a.AddRange(new object[0]));
            AssertExceptionThrown<RuntimeError>(() => a.AddRange(Enumerable(0)));
        }
开发者ID:TerabyteX,项目名称:main,代码行数:50,代码来源:RubyArrayTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RubyContext类代码示例发布时间:2022-05-24
下一篇:
C# DataClasses.DbService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap