NVelocity.Runtime.Parser.Node.ASTStringLiteral.ProcessDictEntry C# (CSharp) Method

ProcessDictEntry() private method

private ProcessDictEntry ( HybridDictionary map, StringBuilder keyBuilder, StringBuilder value, bool isTextContent, IInternalContextAdapter context ) : void
map System.Collections.Specialized.HybridDictionary
keyBuilder StringBuilder
value StringBuilder
isTextContent bool
context IInternalContextAdapter
return void
		private void ProcessDictEntry(HybridDictionary map,
		                              StringBuilder keyBuilder, StringBuilder value,
		                              bool isTextContent, IInternalContextAdapter context)
		{
			object val = value.ToString().Trim();

			// Is it a reference?
			if (val.ToString().StartsWith("$") || val.ToString().IndexOf('$') != -1)
			{
				val = EvaluateInPlace(val.ToString(), context);
			}
			else if (!isTextContent)
			{
				// Is it a Int32 or Single?

				if (val.ToString().IndexOf('.') == -1)
				{
					try
					{
						val = Convert.ToInt32(val);
					}
					catch(Exception)
					{
						throw new ArgumentException("Could not convert dictionary value for entry " + keyBuilder + " with value " + val +
						                            " to Int32. If the value is supposed to be a string, it must be enclosed with '' (single quotes)");
					}
				}
				else
				{
					try
					{
						val = Convert.ToSingle(val);
					}
					catch(Exception)
					{
						throw new ArgumentException("Could not convert dictionary value for entry " + keyBuilder + " with value " + val +
						                            " to Single. If the value is supposed to be a string, it must be enclosed with '' (single quotes)");
					}
				}
			}

			ProcessDictEntry(map, keyBuilder, val, context);

			// Reset buffers

			value.Length = 0;
		}

Same methods

ASTStringLiteral::ProcessDictEntry ( HybridDictionary map, StringBuilder keyBuilder, object value, IInternalContextAdapter context ) : void