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


C# Result.SetValue方法代码示例

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


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

示例1: Should_call_graphite_using_TCP

 public void Should_call_graphite_using_TCP()
 {
     var result = new Result("name", new DateTime(2012, 11, 10, 9, 8, 7), "path");
     result.SetValue(1);
     var graphiteClient = new GraphiteTcpClient("metrics.london.ttldev.local", 2003);
     graphiteClient.Send(result);
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:7,代码来源:With_GraphiteClient.cs

示例2: Should_return_a_graphite_message_list

 public void Should_return_a_graphite_message_list()
 {
     var list = new List<IResult>();
     var res = new Result("name", new DateTime(2012, 12, 11, 10, 9, 8), "path");
     res.SetValue(123);
     list.Add(res);
     var graphiteMetrics = new GraphiteMetrics(list);
     var msgList = graphiteMetrics.ToGraphiteMessageList();
     string msg = "path.name 123 1355220548\n";
     Assert.That(msgList, Is.EqualTo(msg));
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:11,代码来源:With_GraphiteMetrics.cs

示例3: Should_send_list_to_graphite_udp

 public void Should_send_list_to_graphite_udp()
 {
     var graphiteUdp = new Graphite.GraphiteUdpClient("metrics.london.ttldev.local");
     var res = new List<IResult>();
     var p1 = new Result("name", DateTime.Now, "test.path1");
     p1.SetValue(20);
     var p2 = new Result("name", DateTime.Now, "test.path2");
     p2.SetValue(20);
     var p3 = new Result("name", DateTime.Now, "test.path3");
     p3.SetValue(30);
     res.Add(p1);
     //res.Add(p2);
     //res.Add(p3);
     graphiteUdp.Send(new GraphiteMetrics(res));
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:15,代码来源:ManualTests.cs

示例4: Get

        public override IList<IResult> Get()
        {
            var rtn = new List<IResult>();

            try
            {
                foreach (var o in this.GetWmiObject(this.Sql, this.machineName, RootPath))
                {
                    var value = -1;
                    var dateTime = DateTime.Now;
                    var name = string.Empty;

                    foreach (var col in o.Properties)
                    {
                        if (col.Type == CimType.String)
                        {
                            name = Convert.ToString(col.Value);
                        }

                        if (col.Type == CimType.UInt32)
                        {
                            value = Convert.ToInt32(col.Value);
                        }

                        if (col.Type == CimType.UInt64)
                        {
                            value = Convert.ToInt32(col.Value);
                        }

                        if (col.Type == CimType.DateTime)
                        {
                            dateTime = Convert.ToDateTime(col.Value);
                        }
                    }

                    this.Log.Debug(string.Format("Name {0} value {1} datetime {2}", name, value, dateTime));
                    var r = new Result(name, dateTime, this.Path);
                    r.SetValue(value);
                    rtn.Add(r);
                }
            }
            catch (ManagementException e)
            {
                this.Log.Error(string.Format("Error with {0} {1} {2}", this.Type, this.Path, this.Sql));
                this.Log.Error(e.Message);
                this.Log.Error(e.StackTrace);
            }

            return rtn;
        }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:50,代码来源:WmiClient.cs

示例5: Map

        private Result Map(IDataRecord record)
        {
            var value = -1;
            var dateTime = DateTime.Now;
            var name = string.Empty;
            for (int i = 0; i < record.FieldCount; i++)
            {
                if (record[i] is string)
                {
                    name = Convert.ToString(record.GetValue(i));
                }

                if (record[i] is int)
                {
                    value = record.GetInt32(i);
                }

                if (record[i] is DateTime)
                {
                    dateTime = record.GetDateTime(i);
                }
            }

            this.Log.Debug(string.Format("Got [{1}] {0}", value, dateTime));
            var r = new Result(name, dateTime, this.Path);
            r.SetValue(value);
            return r;
        }
开发者ID:perryofpeek,项目名称:SqlToGraphitePlugin-SqlServer,代码行数:28,代码来源:SqlServerClient.cs

示例6: InvokeSafely

		/// <summary>
		/// Used by the safe synchronization delegate.
		/// </summary>
		/// <param name="invocation">The invocation.</param>
		/// <param name="result">The result holder.</param>
		private static void InvokeSafely(IInvocation invocation, Result result)
		{
			if (result == null)
			{
				invocation.Proceed();
			}
			else
			{
				try
				{
					invocation.Proceed();
					result.SetValue(false, invocation.ReturnValue);
				}
				catch (Exception exception)
				{
					result.SetException(false, exception);
				}
			}
		}
开发者ID:ralescano,项目名称:castle,代码行数:24,代码来源:SynchronizeInterceptor.cs

示例7: InvokeSynchronously

		/// <summary>
		/// Continues the invocation synchronously.
		/// </summary>
		/// <param name="invocation">The invocation.</param>
		/// <param name="result">The result holder.</param>
		private static void InvokeSynchronously(IInvocation invocation, Result result)
		{
			invocation.Proceed();

			result = result ?? CreateResult(invocation);
			if (result != null)
			{
				result.SetValue(true, invocation.ReturnValue);
			}
		}
开发者ID:ralescano,项目名称:castle,代码行数:15,代码来源:SynchronizeInterceptor.cs

示例8: TotalFailed

 private Result TotalFailed(CcTray tray, DateTime now)
 {
     var totalFailed = new Result("TotalFailed", now, this.Path);
     totalFailed.SetValue(tray.FailedPipelines().Count);
     return totalFailed;
 }
开发者ID:perryofpeek,项目名称:SqlToGraphitePlugin-CCTray,代码行数:6,代码来源:CCTrayClient.cs

示例9: Map

        private Result Map(DataRow record)
        {
            var value = -1;
            var dateTime = DateTime.Now;
            var name = string.Empty;
            for (int i = 0; i < record.ItemArray.Length; i++)
            {
                if (record[i] is string)
                {
                    name = Convert.ToString(record[i]);
                }

                if (record[i] is int || record[i] is decimal)
                {
                    value = Convert.ToInt32(record[i]);
                }

                if (record[i] is DateTime)
                {
                    dateTime = Convert.ToDateTime(record[i]);
                }
            }

            this.Log.Debug(string.Format("Got [{1}] {0}", value, dateTime));
            var res = new Result(name, dateTime, this.Path);
            res.SetValue(value);
            return res;
        }
开发者ID:perryofpeek,项目名称:SqlToGraphitePlugin-Oracle,代码行数:28,代码来源:OracleClient.cs

示例10: Map

        private Result Map(ILogRecord record)
        {
            var value = -1;
            var dateTime = DateTime.Now;
            var name = string.Empty;

            var r = record.getValue(0);
            if ((r is string))
            {
                name = Convert.ToString(r);
            }

            if ((r is int) || (r is decimal))
            {
                value = Convert.ToInt32(r);
            }

            r = record.getValue(1);
            if ((r is string))
            {
                name = Convert.ToString(r);
            }

            if ((r is int) || (r is decimal))
            {
                value = Convert.ToInt32(r);
            }

            //Console.WriteLine(record.getValue(0).GetType());
            //Console.WriteLine(record.getValue(1).GetType());
            try
            {
                //Console.WriteLine(record.getValue(2));
            }
            catch (Exception ex)
            {

                var s = ex.Message;
            }

            //Console.WriteLine(string.Format("{0} {1}", record.getValue(0), record.getValue(1)));

            //for (int i = 0; i < record.; i++)
            //{
            //    if (record[i] is string)
            //    {
            //        name = Convert.ToString(record[i]);
            //    }

            //    if (record[i] is int || record[i] is decimal)
            //    {
            //        value = Convert.ToInt32(record[i]);
            //    }

            //    if (record[i] is DateTime)
            //    {
            //        dateTime = Convert.ToDateTime(record[i]);
            //    }
            //}

            if (this.Name != string.Empty && name == string.Empty)
            {
                name = this.Name;
            }

            this.Log.Debug(string.Format("Got [{1}] {0}", value, dateTime));
            var result = new Result(name, dateTime, this.Path);
            result.SetValue(value);
            return result;
        }
开发者ID:perryofpeek,项目名称:SqlToGraphitePlugin-LogParser,代码行数:70,代码来源:LogParserClient.cs


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