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


C# IValue.ToString方法代码示例

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


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

示例1: DecryptDataAES

        public static ByteValue DecryptDataAES(IValue cipherText, byte[] Key, byte[] IV)
        {
            // Check arguments.
            if (cipherText == null || cipherText.ToString().Length <= 0)
                throw new ArgumentNullException("cipherText");
            if (Key == null || Key.Length <= 0)
                throw new ArgumentNullException("Key");
            if (IV == null || IV.Length <= 0)
                throw new ArgumentNullException("Key");

            // Declare the string used to hold
            // the decrypted text.
            string plaintext = null;

            // Create an AesManaged object
            // with the specified key and IV.
            using (AesManaged aesAlg = new AesManaged())
            {
                aesAlg.Key = Key;
                aesAlg.IV = IV;

                // Create a decrytor to perform the stream transform.
                ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for decryption.
                using (MemoryStream msDecrypt = new MemoryStream(StreamFactory.GetBytes(cipherText.ToString())))
                // using (MemoryStream msDecrypt = new MemoryStream(cipherText.GetBytes()))
                {
                    using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                    {
                        using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                        {
                            // Read the decrypted bytes from the decrypting stream
                            // and place them in a string.
                            plaintext = srDecrypt.ReadToEnd();
                        }
                    }
                }
            }
            return new ByteValue(StreamFactory.GetBytes(plaintext));
        }
开发者ID:smosgin,项目名称:labofthings,代码行数:41,代码来源:Crypto.cs

示例2: StatementRecordPairValues

        /// <summary>
        /// Save how we are going to go after the statement and generate it.
        /// </summary>
        /// <param name="mapStorage">We own this variable - we can change its name</param>
        /// <param name="indexVar"></param>
        /// <param name="indexValue"></param>
        public StatementRecordPairValues(IDeclaredParameter mapStorage, IValue indexVar, IValue indexValue)
        {
            //
            // Input checks.
            //

            if (mapStorage == null)
                throw new ArgumentNullException("mapStorage");
            if (indexVar == null)
                throw new ArgumentNullException("indexVar");
            if (indexValue == null)
                throw new ArgumentNullException("indexValue");

            //
            // Save for later
            //

            this._index = indexVar;

            AddSaver(mapStorage, indexValue);

            Debug.WriteLine("Emit StatementRecordPairValues: IndexVar {0}, indexValue {1}", indexVar.ToString(), indexValue.ToString());
        }
开发者ID:gordonwatts,项目名称:LINQtoROOT,代码行数:29,代码来源:StatementRecordPairValues.cs

示例3: EncryptDataAES

        public static ByteValue EncryptDataAES(IValue plainText, byte[] Key, byte[] IV) {
            // Check arguments. 
            if (plainText == null || plainText.ToString().Length <= 0)
                throw new ArgumentNullException("plainText");
            if (Key == null || Key.Length <= 0)
                throw new ArgumentNullException("Key");
            if (IV == null || IV.Length <= 0)
                throw new ArgumentNullException("Key");
            byte[] encrypted;
            // Create an AesManaged object 
            // with the specified key and IV. 
            using (AesManaged aesAlg = new AesManaged())
            {
                aesAlg.Key = Key;
                aesAlg.IV = IV;

                // Create a decrytor to perform the stream transform.
                ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for encryption. 
                using (MemoryStream msEncrypt = new MemoryStream())
                {
                    using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                    {
                        using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
                        {
                            //Write all data to the stream.
                            swEncrypt.Write(plainText.ToString());
                        }
                        encrypted = msEncrypt.ToArray();
                    }
                }
            }
            // Return the encrypted bytes from the memory stream. 
            return new ByteValue(encrypted);
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:36,代码来源:Crypto.cs

示例4: Less

 // left < right
 public virtual bool Less(IValue left, IValue right)
 {
     throw new TypeInconsistancyException("Cannot compare " + left.ToString() + " with " + right.ToString());
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:5,代码来源:Type.cs

示例5: ProcessValue

 /// <summary>
 /// Process each token that is to be used.
 /// </summary>
 /// <param name="value"></param>
 /// <returns>The value of the token after evaluation.</returns>
 protected override string ProcessValue(IValue value)
 {
     try
     {
         IValue converted = value.Evaluate(Element, true);
         if (!converted.IsExpression)
             return converted.StringValue;
         if (value.IsVariableExpression)
             return "&nbsp;";
         return converted.ToString();
     }
     catch
     {
         return value.ToString();
     }
 }
开发者ID:MotorViper,项目名称:FormGenerator,代码行数:21,代码来源:Field.cs

示例6: RememberSubExpression

        /// <summary>
        /// Remember a sub-expression. We will hide a previously made association!
        /// </summary>
        /// <param name="expr"></param>
        /// <param name="r"></param>
        public void RememberSubExpression(Expression expr, IValue r)
        {
            var key = GetSubExpressionKey(expr);
            if (key == null)
                return;

            CurrentRememberedExpressions[key] = r;
            Debug.WriteLine("RememberSubExpression: {0} => {1}", key, r.ToString());
        }
开发者ID:gordonwatts,项目名称:LINQtoROOT,代码行数:14,代码来源:GeneratedCode.cs


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