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


C# Symbol.ToString方法代码示例

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


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

示例1: GetBrokerageSymbol

        /// <summary>
        /// Converts a Lean symbol instance to an InteractiveBrokers symbol
        /// </summary>
        /// <param name="symbol">A Lean symbol instance</param>
        /// <returns>The InteractiveBrokers symbol</returns>
        public string GetBrokerageSymbol(Symbol symbol)
        {
            if (symbol == null || symbol == Symbol.Empty || string.IsNullOrWhiteSpace(symbol.Value))
                throw new ArgumentException("Invalid symbol: " + (symbol == null ? "null" : symbol.ToString()));

            if (symbol.ID.SecurityType != SecurityType.Forex && symbol.ID.SecurityType != SecurityType.Equity)
                throw new ArgumentException("Invalid security type: " + symbol.ID.SecurityType);

            if (symbol.ID.SecurityType == SecurityType.Forex && symbol.Value.Length != 6)
                throw new ArgumentException("Forex symbol length must be equal to 6: " + symbol.Value);

            return symbol.Value;
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:18,代码来源:InteractiveBrokersSymbolMapper.cs

示例2: Atom

        public Atom(Symbol symbol, Vector2 position, GameContent gameContent, World world)
        {
            this.gameContent = gameContent;
            this.world = world;

            if (symbol == Symbol.Ra) eye = EyeState.Angry;

            this.symbol = symbol;
            this.symbolStr = symbol.ToString();
            symbolCenter = gameContent.symbolFont.MeasureString(this.symbolStr);
            symbolCenter.X *= 0.5f;
            symbolCenter.Y *= 0.92f;

            bondsLeft = (int)symbol;

            BodyDef bd = new BodyDef();
            bd.type = BodyType.Dynamic;
            bd.position = this.position = position / gameContent.b2Scale;
            bd.bullet = true;
            body = world.CreateBody(bd);
            body.SetUserData(this);

            CircleShape cs = new CircleShape();
            cs._radius = gameContent.atomRadius / gameContent.b2Scale;

            FixtureDef fd = new FixtureDef();
            fd.shape = cs;
            fd.restitution = 0.2f;
            fd.friction = 0.5f;

            fixture = body.CreateFixture(fd);

            electroShockAnimation = new Animation(gameContent.electroShock, 3, 0.1f, true, new Vector2(0.5f, 0.5f));

            radiationSmoke = new RadiationSmoke(gameContent, this);

            // Collide only with Ground but not with itself and bonded Filter
            mouseFilter = new Filter();
            mouseFilter.categoryBits = 0x0002; mouseFilter.maskBits = 0x0001; mouseFilter.groupIndex = -2;

            // Collide with every thing
            atomFilter = new Filter();
            atomFilter.categoryBits = 0x0001; atomFilter.maskBits = 0x0001; atomFilter.groupIndex = 1;

            fixture.SetFilterData(ref atomFilter);

            SetMode(false, false);
        }
开发者ID:BitSits,项目名称:BitSits-Framework-10---Atooms-To-Moolecule,代码行数:48,代码来源:Atom.cs

示例3: ParseAugments

        private static string ParseAugments(IEnumerator<Symbol> enumerator, ref Symbol temp)
        {
            string augment = null;
            if (temp == Symbol.Augments)
            {
                temp = enumerator.NextNonEOLSymbol();

                temp.Expect(Symbol.OpenBracket);
                temp = enumerator.NextNonEOLSymbol();

                augment = temp.ToString();
                temp = enumerator.NextNonEOLSymbol();

                temp.Expect(Symbol.CloseBracket);
                temp = enumerator.NextNonEOLSymbol();
            }
            return augment;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:18,代码来源:ObjectType.cs

示例4: TypeAssignment

        public TypeAssignment(string module, string name, IEnumerator<Symbol> enumerator, ref Symbol temp)
        {
            _module = module;
            _name = name;
            Value = temp.ToString();

            temp = enumerator.NextNonEOLSymbol();

            if (temp == Symbol.OpenBracket)
            {
                DecodeEnumerations(enumerator);
                temp = enumerator.NextNonEOLSymbol();
            }
            else if (temp == Symbol.OpenParentheses)
            {
                DecodeRanges(enumerator);
                temp = enumerator.NextNonEOLSymbol();
            }
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:19,代码来源:TypeAssignment.cs

示例5: Log

        public void Log(OutputSeverityLevel severity, string source, Symbol symbol, string message)
        {
            _systemData.Output.Add(severity, message, symbol, source);

            DateTime currentTime;
            if (_systemData.LiveMode)
            {
                currentTime = DateTime.Now;
            }
            else
            {
                currentTime = _systemData.CurrentDate;
            }

            string systemDirectory = Path.GetDirectoryName(_systemData.TradingSystemProjectPath);
            string logFileName;
            if (_systemData.LiveMode)
            {
                logFileName = Path.Combine(systemDirectory, "LiveSystemLog_" + currentTime.ToString("yyyy'-'MM'-'dd") + ".txt");
            }
            else
            {
                logFileName = Path.Combine(systemDirectory, "SimSystemLog_" + _systemStartTime.ToString("yyyy'-'MM'-'dd' 'HH'-'mm'-'ss") + ".txt");
            }

            string sourceString = string.Empty;
            if (!string.IsNullOrEmpty(source))
            {
                sourceString = " " + source;
            }

            string symbolString = string.Empty;
            if (symbol != null)
            {
                symbolString = " " + symbol.ToString();
            }

            File.AppendAllText(logFileName, string.Format("{0}{1}{2}: {3}",
                currentTime.ToString("yyyy'-'MM'-'dd' 'HH'-'mm'-'ss"), sourceString, symbolString, message) + Environment.NewLine);
        }
开发者ID:dsplaisted,项目名称:RightEdgeUtil,代码行数:40,代码来源:SystemLogger.cs

示例6: IsProperty

 private static bool IsProperty(Symbol sym)
 {
     string s = sym.ToString();
     return s == "SYNTAX" || s == "MAX-ACCESS" || s == "STATUS" || s == "DESCRIPTION";
 }
开发者ID:plocklsh,项目名称:lwip,代码行数:5,代码来源:ObjectType.cs

示例7: Build

        internal static ObjExpr Build(
            IPersistentVector interfaceSyms, 
            IPersistentVector fieldSyms, 
            Symbol thisSym,
            string tagName, 
            Symbol className, 
            Symbol typeTag, 
            ISeq methodForms,
            Object frm,
            IPersistentMap opts)
        {
            NewInstanceExpr ret = new NewInstanceExpr(null);
            ret.Src = frm;
            ret.Name = className.ToString();
            ret.ClassMeta = GenInterface.ExtractAttributes(RT.meta(className));
            ret.InternalName = ret.Name;  // ret.Name.Replace('.', '/');
            // Java: ret.objtype = Type.getObjectType(ret.internalName);
            ret.Opts = opts;

            if (thisSym != null)
                ret.ThisName = thisSym.Name;

            if (fieldSyms != null)
            {
                IPersistentMap fmap = PersistentHashMap.EMPTY;
                object[] closesvec = new object[2 * fieldSyms.count()];
                for (int i = 0; i < fieldSyms.count(); i++)
                {
                    Symbol sym = (Symbol)fieldSyms.nth(i);
                    LocalBinding lb = new LocalBinding(-1, sym, null, new MethodParamExpr(Compiler.TagType(Compiler.TagOf(sym))), false, false, false);
                    fmap = fmap.assoc(sym, lb);
                    closesvec[i * 2] = lb;
                    closesvec[i * 2 + 1] = lb;
                }
                // Java TODO: inject __meta et al into closes - when?
                // use array map to preserve ctor order
                ret.Closes = new PersistentArrayMap(closesvec);
                ret.Fields = fmap;
                for (int i = fieldSyms.count() - 1; i >= 0 && (((Symbol)fieldSyms.nth(i)).Name.Equals("__meta") || ((Symbol)fieldSyms.nth(i)).Name.Equals("__extmap")); --i)
                    ret.AltCtorDrops++;
            }

            // Java TODO: set up volatiles
            //ret._volatiles = PersistentHashSet.create(RT.seq(RT.get(ret._optionsMap, volatileKey)));

            IPersistentVector interfaces = PersistentVector.EMPTY;
            for (ISeq s = RT.seq(interfaceSyms); s != null; s = s.next())
            {
                Type t = (Type)Compiler.Resolve((Symbol)s.first());
                if (!t.IsInterface)
                    throw new ParseException("only interfaces are supported, had: " + t.Name);
                interfaces = interfaces.cons(t);
            }
            Type superClass = typeof(Object);

            Dictionary<IPersistentVector, IList<MethodInfo>> overrideables;
            Dictionary<IPersistentVector, IList<MethodInfo>> explicits;
            GatherMethods(superClass, RT.seq(interfaces), out overrideables, out explicits);

            ret._methodMap = overrideables;

  
            GenContext context = Compiler.IsCompiling
                ? Compiler.CompilerContextVar.get() as GenContext
                : (ret.IsDefType
                    ? GenContext.CreateWithExternalAssembly("deftype" + RT.nextID().ToString(), ".dll", true)
                    : (Compiler.CompilerContextVar.get() as GenContext
                        ??
                        Compiler.EvalContext));

            GenContext genC = context.WithNewDynInitHelper(ret.InternalName + "__dynInitHelper_" + RT.nextID().ToString());

            Type baseClass = ret.CompileBaseClass(genC, superClass, SeqToTypeArray(interfaces), frm);
            Symbol thisTag = Symbol.intern(null, baseClass.FullName);

            try
            {
                Var.pushThreadBindings(
                    RT.mapUniqueKeys(
                        Compiler.ConstantsVar, PersistentVector.EMPTY,
                        Compiler.ConstantIdsVar, new IdentityHashMap(),
                        Compiler.KeywordsVar, PersistentHashMap.EMPTY,
                        Compiler.VarsVar, PersistentHashMap.EMPTY,
                        Compiler.KeywordCallsitesVar, PersistentVector.EMPTY,
                        Compiler.ProtocolCallsitesVar, PersistentVector.EMPTY,
                        Compiler.VarCallsitesVar, Compiler.EmptyVarCallSites(),
                        Compiler.NoRecurVar, null,
                        Compiler.CompilerContextVar, genC
                        ));

                if (ret.IsDefType)
                {
                    Var.pushThreadBindings(
                        RT.mapUniqueKeys(
                            Compiler.MethodVar, null,
                            Compiler.LocalEnvVar, ret.Fields,
                            Compiler.CompileStubSymVar, Symbol.intern(null, tagName),
                            Compiler.CompileStubClassVar, baseClass
                            ));
                    ret.HintedFields = RT.subvec(fieldSyms, 0, fieldSyms.count() - ret.AltCtorDrops);
//.........这里部分代码省略.........
开发者ID:TerabyteX,项目名称:clojure-clr,代码行数:101,代码来源:NewInstanceExpr.cs

示例8: ParseReference

        private static string ParseReference(IEnumerator<Symbol> enumerator, ref Symbol temp)
        {
            string reference = null;
            if (temp == Symbol.Reference)
            {
                temp = enumerator.NextNonEOLSymbol();

                reference = temp.ToString();
                temp = enumerator.NextNonEOLSymbol();
            }
            return reference;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:ObjectType.cs

示例9: DecodeNumber

        public static Int64? DecodeNumber(Symbol number)
        {
            Int64  result;
            string numString = (number != null) ? number.ToString() : null;

            if (!String.IsNullOrEmpty(numString))
            {
                if (numString.StartsWith("'") && (numString.Length > 3))
                {
                    // search second apostrophe
                    int end = numString.IndexOf('\'', 1);
                    if (end == (numString.Length - 2))
                    {
                        try
                        {
                            switch (numString[numString.Length - 1])
                            {
                                case 'b':
                                case 'B':
                                    result = Convert.ToInt64(numString.Substring(1, numString.Length - 3), 2);
                                    return result;
                                case 'h':
                                case 'H':
                                    result = Convert.ToInt64(numString.Substring(1, numString.Length - 3), 16);
                                    return result;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                else if (Int64.TryParse(numString, out result))
                {
                    return result;
                }
            }

            return null;
        }
开发者ID:plocklsh,项目名称:lwip,代码行数:40,代码来源:Lexer.cs

示例10: ClearTest

 public void ClearTest()
 {
     // PrivateObject param0 = null; // TODO: Initialize to an appropriate value
        // Board_Accessor target = new Board_Accessor(param0); // TODO: Initialize to an appropriate value
     int size = 2;
     Board target = Board.createInstance(size);
     Symbol[,] expected = new Symbol[size, size];
     Point position = new Point(0, 0);
     target.PutSymbol(Symbol.Oval,position);
     target.Clear();
     Symbol[,] actual = target.SymbolStore;
     Assert.AreEqual(expected.ToString(), actual.ToString());
        // Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
开发者ID:PraveenSenathi,项目名称:Game_C-_SoftEngg,代码行数:14,代码来源:BoardTest.cs

示例11: ParseStatus

        private static Status ParseStatus(IEnumerator<Symbol> enumerator, ref Symbol temp)
        {
            Status status = Status.Obsolete;

            temp.Expect(Symbol.Status);
            temp = enumerator.NextNonEOLSymbol();

            try
            {
                status = StatusHelper.CreateStatus(temp.ToString());
                temp = enumerator.NextNonEOLSymbol();
            }
            catch (ArgumentException)
            {
                temp.Throw("Invalid status");
            }
            return status;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:18,代码来源:ObjectType.cs

示例12: Get

        /// <summary>
        /// Get historical data enumerable for a single symbol, type and resolution given this start and end time (in UTC).
        /// </summary>
        /// <param name="symbol">Symbol for the data we're looking for.</param>
        /// <param name="type">Security type</param>
        /// <param name="resolution">Resolution of the data request</param>
        /// <param name="startUtc">Start time of the data in UTC</param>
        /// <param name="endUtc">End time of the data in UTC</param>
        /// <returns>Enumerable of base data for this symbol</returns>
        public IEnumerable<BaseData> Get(Symbol symbol, SecurityType type, Resolution resolution, DateTime startUtc, DateTime endUtc)
        {
            if (!_instruments.ContainsKey(symbol.Value))
                throw new ArgumentException("Invalid symbol requested: " + symbol.ToString());

            if (type != SecurityType.Forex && type != SecurityType.Cfd)
                throw new NotSupportedException("SecurityType not available: " + type);

            if (endUtc < startUtc)
                throw new ArgumentException("The end date must be greater or equal to the start date.");

            // set the starting date
            DateTime date = startUtc;

            // loop until last date
            while (date <= endUtc)
            {
                // request all ticks for a specific date
                var ticks = DownloadTicks(symbol, date);

                switch (resolution)
                {
                    case Resolution.Tick:
                        foreach (var tick in ticks)
                        {
                            yield return new Tick(tick.Time, symbol, Convert.ToDecimal(tick.BidPrice), Convert.ToDecimal(tick.AskPrice));
                        }
                        break;

                    case Resolution.Second:
                        foreach (var bar in AggregateTicks(symbol, ticks, new TimeSpan(0, 0, 1)))
                        {
                            yield return bar;
                        }
                        break;

                    case Resolution.Minute:
                        foreach (var bar in AggregateTicks(symbol, ticks, new TimeSpan(0, 1, 0)))
                        {
                            yield return bar;
                        }
                        break;

                    case Resolution.Hour:
                        foreach (var bar in AggregateTicks(symbol, ticks, new TimeSpan(1, 0, 0)))
                        {
                            yield return bar;
                        }
                        break;

                    case Resolution.Daily:
                        foreach (var bar in AggregateTicks(symbol, ticks, new TimeSpan(1, 0, 0, 0)))
                        {
                            yield return bar;
                        }
                        break;
                }

                date = date.AddDays(1);
            }
        }
开发者ID:vikewoods,项目名称:Lean,代码行数:70,代码来源:DukascopyDataDownloader.cs

示例13: symbol

 protected virtual void symbol(Symbol s) 
 { 
     Post("Test-SYMBOL "+s.ToString()); 
     Outlet(0,s);
 }
开发者ID:ma4u,项目名称:pd-macambira,代码行数:5,代码来源:test.cs

示例14: MyAnything

 protected virtual void MyAnything(int ix,Symbol s,Atom[] l) 
 { 
     Post(ix.ToString()+": Test-("+s.ToString()+") "+l.ToString()); 
     Outlet(0,s,l);
 }
开发者ID:ma4u,项目名称:pd-macambira,代码行数:5,代码来源:test.cs

示例15: ParseUnits

        private static string ParseUnits(IEnumerator<Symbol> enumerator, ref Symbol temp)
        {
            string units = null;

            if (temp == Symbol.Units)
            {
                temp = enumerator.NextNonEOLSymbol();

                units = temp.ToString();
                temp = enumerator.NextNonEOLSymbol();
            }

            return units;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:14,代码来源:ObjectType.cs


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