本文整理汇总了C#中Func.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Func.ToString方法的具体用法?C# Func.ToString怎么用?C# Func.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WindowsServiceRunner
/// <summary>
/// Executes the provided IWindowsServices and supports automatic installation using the command line params -install / -uninstall
/// </summary>
/// <param name="args"></param>
/// <param name="createServices">Function which provides a WindowsServiceCollection of services to execute</param>
/// <param name="configureContext">Optional application context configuration</param>
/// <param name="installationSettings">Optional installer configuration with semi-sensible defaults</param>
/// <param name="registerContainer">Optionally register an IoC container</param>
/// <param name="agentSettingsManager">Optionally provide agent settings </param>
public WindowsServiceRunner(string[] args,
Func<IWindowsService[]> createServices,
Action<ApplicationContext> configureContext = null,
Action<System.ServiceProcess.ServiceInstaller,
ServiceProcessInstaller> installationSettings = null,
Func<IIocContainer> registerContainer = null,
IAgentSettingsManager agentSettingsManager = null,
Action<ApplicationContext,string> notify=null)
{
_notify = notify ?? ((ctx,message) => { });
var log = LogManager.GetLogger(typeof (WindowsServiceRunner));
_args = args;
_context = new ApplicationContext();
_createServices = createServices;
_agentSettingsManager = agentSettingsManager;
_logger = log;
_configureContext = configureContext ?? (ctx => { });
_context.ConfigureInstall = installationSettings ?? ((serviceInstaller, serviceProcessInstaller) => { });
_context.Container = registerContainer;
if (registerContainer==null)
{
throw new ArgumentException("Binding container is null");
}
if (registerContainer != null)
{
_logger.DebugFormat("container is " + registerContainer.ToString());
}
}
示例2: AddJavaScript
public static void AddJavaScript(this HtmlHelper htmlHelper, Func<object, HelperResult> script)
{
List<string> scriptList = htmlHelper.ViewContext.HttpContext.Items[_js] as List<string>;
if (scriptList != null)
{
if (!scriptList.Contains(script.ToString()))
{
scriptList.Add(script.Invoke(null).ToString());
}
}
else
{
scriptList = new List<string>();
scriptList.Add(script.Invoke(null).ToString());
htmlHelper.ViewContext.HttpContext.Items.Add(_js, scriptList);
}
}
示例3: CheckGetColorContexts
void CheckGetColorContexts(MainForm form, DataEntry[] de, Func<uint, IWICColorContext[], uint> method)
{
IWICColorContext[] contexts = null;
IWICImagingFactory factory = new WICImagingFactory() as IWICImagingFactory;
try
{
try
{
contexts = new IWICColorContext[method(0, null)];
}
catch (Exception e)
{
form.CheckHRESULT(this, WinCodecError.WINCODEC_ERR_UNSUPPORTEDOPERATION, e, "0, NULL", de);
return;
}
if (contexts.Length > 0)
{
for (int i = 0; i < contexts.Length; i++)
{
contexts[i] = factory.CreateColorContext();
}
try
{
method((uint)contexts.Length, contexts);
int index = 0;
foreach (IWICColorContext c in contexts)
{
if (c == null)
{
form.Add(this, method.ToString(Resources._0_NULLItem), de, new DataEntry(Resources.Index, index));
}
index++;
}
}
catch (Exception e)
{
form.Add(this, method.ToString(Resources._0_Failed), de, new DataEntry(e));
}
}
}
finally
{
contexts.ReleaseComObject();
factory.ReleaseComObject();
}
}
示例4: ComponentInfo
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <param name="contract"></param>
/// <param name="factory"></param>
/// <param name="lifestyleType"></param>
public ComponentInfo(string id, Type contract, Func<object> factory, LifestyleFlags lifestyleType)
{
Guard.NotNull(contract,"contract");
Guard.NotNull(factory,"factory");
contracts.Add(contract);
ContractService.GetContracts(contract, contracts);
Id = id;
if (string.IsNullOrEmpty(id))
Id = factory.ToString() + "/" + contract.FullName;
if (contract.IsOpenGenericType())
Lifestyle = LifestyleType.GetGenericLifestyle(lifestyleType);
else
Lifestyle = LifestyleType.GetLifestyle(lifestyleType);
Activator = ActivatorType.Factory;
Factory = factory;
Name = Id;
}
示例5: ReferenceAllTypesInClosedGenericParametersWithReferences
public void ReferenceAllTypesInClosedGenericParametersWithReferences(
Tuple<IInnerInterface, InnerEventArgs, InnerDelegate> arg0,
List<InnerEnum> innerEnums,
InnerStruct[] innerStructs,
Lazy<InnerStruct.InnerStructInnerEnum> innerStructInnerEnum,
IEnumerable<InnerStruct.IInnerStructInnerInterface> innerStructInnerInterface,
Dictionary<InnerStruct.InnerStructInnerStruct, InnerStruct.InnerStructInnerClass> innerStructInnerClassByInnerStructInnerStruct,
Func<InnerAbstractClass, InnerAbstractClass.InnerAbstractClassInnerEnum, InnerAbstractClass.IInnerAbstractClassInnerInterface> getInnerAbstractClass,
List<Dictionary<InnerAbstractClass.InnerAbstractClassStruct, IEnumerable<InnerImplementingClass[]>>> stuff)
{
string toStringHolder;
toStringHolder = arg0.ToString();
toStringHolder = arg0.Item1.ToString();
toStringHolder = arg0.Item2.ToString();
toStringHolder = arg0.Item3.ToString();
toStringHolder = innerEnums.ToString();
toStringHolder = innerEnums.First().ToString();
toStringHolder = innerStructs.ToString();
toStringHolder = innerStructs[0].ToString();
toStringHolder = innerStructInnerEnum.ToString();
toStringHolder = innerStructInnerEnum.Value.ToString();
toStringHolder = innerStructInnerInterface.ToString();
toStringHolder = innerStructInnerInterface.ToString();
toStringHolder = innerStructInnerClassByInnerStructInnerStruct.ToString();
toStringHolder = innerStructInnerClassByInnerStructInnerStruct.Keys.First().ToString();
toStringHolder = innerStructInnerClassByInnerStructInnerStruct.Values.First().ToString();
toStringHolder = getInnerAbstractClass.ToString();
toStringHolder = stuff.ToString();
toStringHolder = stuff[0].ToString();
toStringHolder = stuff[0].Keys.First().ToString();
toStringHolder = stuff[0].Values.First().ToString();
toStringHolder = stuff[0].Values.First().First().ToString();
}