當前位置: 首頁>>代碼示例>>C#>>正文


C# Function.ToString方法代碼示例

本文整理匯總了C#中System.Function.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Function.ToString方法的具體用法?C# Function.ToString怎麽用?C# Function.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Function的用法示例。


在下文中一共展示了Function.ToString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetFunctionName

 internal virtual string GetFunctionName(Function Function)
 {
     switch (Function)
     {
         case Function.Count: return "COUNT";
         default: throw new NotSupportedException($"The given function (`{Function.ToString()}`) is not supporthed in the surrent context.");
     }
 }
開發者ID:DiligentKeyPresser,項目名稱:nORM,代碼行數:8,代碼來源:SQLContext.cs

示例2: Ensure

        private void Ensure(Function Action, string Name, string Area)
        {
            using (new FunctionLogger(Log))
            {
                var ActionName = Action.ToString();

                Log.InfoFormat("Action: {0}", ActionName);
                Log.InfoFormat("Name: {0}", Name);
                Log.InfoFormat("Area: {0}", Area);

                var ActivityService = ServiceFactory.CreateService<IActivityService>();

                if (ActivityService.Get(ActionName, Name, Area) == null)
                {
                    Log.InfoFormat("Adding activity: {0}, {1}, {2}", Name, Area, ActionName);
                    ActivityService.Save(new Dtos.Activity { Name = Name, Area = Area, Action = ActionName });
                }
            }
        }
開發者ID:skankydog,項目名稱:fido,代碼行數:19,代碼來源:Boot.cs

示例3: WriteWrapper

        int WriteWrapper(BindStreamWriter sw, int current, Function f, EnumCollection enums)
        {
            if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
            {
                string text = String.Format("Writing function #{0}: {1}", current++, f.ToString());
                ConsoleRewrite(text);

                WriteDocumentation(sw, f);
            }
            WriteMethod(sw, f, enums);
            sw.WriteLine();
            return current;
        }
開發者ID:BrainSlugs83,項目名稱:opentk,代碼行數:13,代碼來源:CSharpSpecWriter.cs

示例4: Write

 public void Write(Function f)
 {
     foreach (string s in splitLines.Split(f.ToString()))
         WriteLine(s);
 }
開發者ID:ronsaldo,項目名稱:chela,代碼行數:5,代碼來源:BindStreamWriter.cs

示例5: PerformanceTest

        public static void PerformanceTest(Function function)
        {
            Console.WriteLine("*****" + function.ToString().ToUpper() + "*****");

            float resultFloat = FloatValue;
            StopWatch.Start();

            for (int i = 0; i < OperationsCount; i++)
            {
                switch (function)
                {
                    case Function.Sqrt:
                        resultFloat = (float)Math.Sqrt(FloatValue);
                        break;
                    case Function.Log:
                        resultFloat = (float)Math.Log(FloatValue);
                        break;
                    case Function.Sin:
                        resultFloat = (float)Math.Sin(FloatValue);
                        break;
                    default:
                        throw new InvalidOperationException("Invalid function!");
                }
            }

            StopWatch.Stop();
            Console.WriteLine("{0,-15}:{1}", "Float", StopWatch.Elapsed);
            StopWatch.Reset();

            double resultDouble = DoubleValue;
            StopWatch.Start();

            for (int i = 0; i < OperationsCount; i++)
            {
                switch (function)
                {
                    case Function.Sqrt:
                        resultDouble = (double)Math.Sqrt(DoubleValue);
                        break;
                    case Function.Log:
                        resultDouble = (double)Math.Log(DoubleValue);
                        break;
                    case Function.Sin:
                        resultDouble = (double)Math.Sin(DoubleValue);
                        break;
                    default:
                        throw new InvalidOperationException("Invalid function!");
                }
            }

            StopWatch.Stop();
            Console.WriteLine("{0,-15}:{1}", "Double", StopWatch.Elapsed);
            StopWatch.Reset();

            decimal resultDecimle = DecimalValue;
            StopWatch.Start();

            for (int i = 0; i < OperationsCount; i++)
            {
                switch (function)
                {
                    case Function.Sqrt:
                        resultDecimle = (decimal)Math.Sqrt((double)DecimalValue);
                        break;
                    case Function.Log:
                        resultDecimle = (decimal)Math.Log((double)DecimalValue);
                        break;
                    case Function.Sin:
                        resultDecimle = (decimal)Math.Sin((double)DecimalValue);
                        break;
                    default:
                        throw new InvalidOperationException("Invalid function!");
                }
            }

            StopWatch.Stop();
            Console.WriteLine("{0,-15}:{1}", "Decimal", StopWatch.Elapsed);
            StopWatch.Reset();
        }
開發者ID:ivanvasilev,項目名稱:Telerik-Academy-Homeworks,代碼行數:79,代碼來源:MathFunctionsTester.cs


注:本文中的System.Function.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。