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


C# ISequence.__len__方法代码示例

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


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

示例1: stat_result

            public stat_result(CodeContext/*!*/ context, ISequence statResult, [DefaultParameterValue(null)]PythonDictionary dict) {
                // dict is allowed by CPython's stat_result, but doesn't seem to do anything, so we ignore it here.

                if (statResult.__len__() < 10) {
                    throw PythonOps.TypeError("stat_result() takes an at least 10-sequence ({0}-sequence given)", statResult.__len__());
                }

                _mode = statResult[0];
                _ino = statResult[1];
                _dev = statResult[2];
                _nlink = statResult[3];
                _uid = statResult[4];
                _gid = statResult[5];
                _size = statResult[6];
                _atime = statResult[7];
                _mtime = statResult[8];
                _ctime = statResult[9];

                object dictTime;
                if (statResult.__len__() >= 11) {
                    _st_atime = TryShrinkToInt(statResult[10]);
                } else if (TryGetDictValue(dict, "st_atime", out dictTime)) {
                    _st_atime = dictTime;
                } else {
                    _st_atime = TryShrinkToInt(_atime);
                }

                if (statResult.__len__() >= 12) {
                    _st_mtime = TryShrinkToInt(statResult[11]);
                } else if (TryGetDictValue(dict, "st_mtime", out dictTime)) {
                    _st_mtime = dictTime;
                } else { 
                    _st_mtime = TryShrinkToInt(_mtime);
                }

                if (statResult.__len__() >= 13) {
                    _st_ctime = TryShrinkToInt(statResult[12]);
                } else if (TryGetDictValue(dict, "st_ctime", out dictTime)) {
                    _st_ctime = dictTime;
                } else { 
                    _st_ctime = TryShrinkToInt(_ctime);
                }
            }
开发者ID:jcteague,项目名称:ironruby,代码行数:43,代码来源:nt.cs

示例2: SequenceSliceAssign

        private static void SequenceSliceAssign(SliceAssign assign, int start, int n, int step, ISequence lst) {
            if (lst.__len__() < n) throw PythonOps.ValueError("too few items in the enumerator. need {0}", n);
            else if (lst.__len__() != n) throw PythonOps.ValueError("too many items in the enumerator need {0}", n);

            for (int i = 0, index = start; i < n; i++, index += step) {
                assign(index, lst[i]);
            }

        }
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:Slice.cs


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