本文整理汇总了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.");
}
}
示例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 });
}
}
}
示例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;
}
示例4: Write
public void Write(Function f)
{
foreach (string s in splitLines.Split(f.ToString()))
WriteLine(s);
}
示例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();
}