本文整理汇总了C#中this.AddValue方法的典型用法代码示例。如果您正苦于以下问题:C# this.AddValue方法的具体用法?C# this.AddValue怎么用?C# this.AddValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类this
的用法示例。
在下文中一共展示了this.AddValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddValueWithType
public static void AddValueWithType(this SerializationInfo Info, String Name, Object Object)
{
if (Object == null)
{
Info.AddValue(Name + ".Type", "Nothing");
}
else
{
Info.AddValue(Name + ".Type", Object.GetType().FullName);
Info.AddValue(Name, Object, Object.GetType());
}
}
示例2: TryAddValue
/// <summary>
/// Checks if a value exists for a node, if not, it adds one.
/// </summary>
public static void TryAddValue(this ConfigNode node, string name, string value)
{
if (!node.HasValue(name))
{
node.AddValue(name, value);
}
}
示例3: Globalization
/// <summary>
/// Configures <see cref="GlobalizationConfiguration"/>
/// </summary>
/// <param name="environment">An <see cref="INancyEnvironment"/> that should be configured.</param>
/// <param name="supportedCultureNames">Cultures that the application can accept</param>
/// <param name="defaultCulture">Used to set a default culture for the application</param>
/// <param name="dateTimeStyles">The <see cref="DateTimeStyles"/> that should be used for date parsing.</param>
/// <remarks>If defaultCulture not specified the first supported culture is used</remarks>
public static void Globalization(this INancyEnvironment environment, IEnumerable<string> supportedCultureNames, string defaultCulture = null, DateTimeStyles? dateTimeStyles = null)
{
environment.AddValue(new GlobalizationConfiguration(
supportedCultureNames: supportedCultureNames,
defaultCulture: defaultCulture,
dateTimeStyles: dateTimeStyles));
}
示例4: Json
/// <summary>
/// Configures JSON serialization.
/// </summary>
/// <param name="environment"><see cref="INancyEnvironment"/> that should be configured.</param>
/// <param name="maxJsonLength">Max length of JSON output.</param>
/// <param name="defaultEncoding">The <see cref="Encoding"/> that should be as a default.</param>
/// <param name="converters">List of <see cref="JavaScriptConverter"/> that should be used.</param>
/// <param name="primitiveConverters">List of <see cref="JavaScriptPrimitiveConverter"/> that should be used.</param>
/// <param name="retainCasing"><see langword="true" /> if C# casing should be retained, otherwise <see langword="false" /> to use camel-casing.</param>
public static void Json(this INancyEnvironment environment, int? maxJsonLength = null, Encoding defaultEncoding = null, IList<JavaScriptConverter> converters = null, IList<JavaScriptPrimitiveConverter> primitiveConverters = null, bool? retainCasing = null)
{
environment.AddValue(new JsonConfiguration(
defaultEncoding ?? JsonConfiguration.Default.DefaultEncoding,
converters ?? JsonConfiguration.Default.Converters,
primitiveConverters ?? JsonConfiguration.Default.PrimitiveConverters,
retainCasing ?? JsonConfiguration.Default.RetainCasing));
}
示例5: AddValue
/// <summary>SqlParameterCollection に連番のパラメタとその値を設定する。
/// </summary>
/// <param name="parameters"></param>
/// <param name="parameternamePrefix"></param>
/// <param name="values"></param>
public static void AddValue(this SqlParameterCollection parameters, string parameternamePrefix, IEnumerable<int> values)
{
int i = -1;
foreach (var value in values)
{
parameters.AddValue(parameternamePrefix + (++i), value);
}
}
示例6: Diagnostics
/// <summary>
/// Configures diagnostics.
/// </summary>
/// <param name="environment"><see cref="INancyEnvironment"/> that should be configured.</param>
/// <param name="password">Password used to secure the dashboard.</param>
/// <param name="path">Relative path of the dashboard.</param>
/// <param name="cookieName">Name of the cookie to store diagnostics information.</param>
/// <param name="slidingTimeout">Number of minutes that expiry of the diagnostics dashboard.</param>
/// <param name="cryptographyConfiguration">Cryptography config to use for securing the dashboard.</param>
public static void Diagnostics(this INancyEnvironment environment, string password, string path = null, string cookieName = null, int slidingTimeout = 15, CryptographyConfiguration cryptographyConfiguration = null)
{
environment.AddValue(new DiagnosticsConfiguration(
password,
path,
cookieName,
slidingTimeout,
cryptographyConfiguration));
}
示例7: GetAddValue
/// <summary>
/// Gets a value if available, otherwise adds the value and then returns the defaultValue
/// </summary>
public static string GetAddValue(this ConfigNode node, string name, string defaultValue)
{
if (node.HasValue(name))
{
return node.GetValue(name);
}
node.AddValue(name, defaultValue);
return defaultValue;
}
示例8: Json
/// <summary>
/// Configures JSON serialization.
/// </summary>
/// <param name="environment"><see cref="INancyEnvironment"/> that should be configured.</param>
/// <param name="useIso8601DateFormat"><see langword="true" /> if ISO-860 date formats should be used, otherwise <see langword="false" />.</param>
/// <param name="maxJsonLength">Max length of JSON output.</param>
/// <param name="maxRecursions">Maximum number of recursions.</param>
/// <param name="defaultEncoding">The <see cref="Encoding"/> that should be as a default.</param>
/// <param name="converters">List of <see cref="JavaScriptConverter"/> that should be used.</param>
/// <param name="primitiveConverters">List of <see cref="JavaScriptPrimitiveConverter"/> that should be used.</param>
/// <param name="retainCasing"><see langword="true" /> if C# casing should be retained, otherwise <see langword="false" /> to use camel-casing.</param>
public static void Json(this INancyEnvironment environment, bool? useIso8601DateFormat = null, int? maxJsonLength = null, int? maxRecursions = null, Encoding defaultEncoding = null, IList<JavaScriptConverter> converters = null, IList<JavaScriptPrimitiveConverter> primitiveConverters = null, bool? retainCasing = null)
{
environment.AddValue(new JsonConfiguration(
useIso8601DateFormat ?? JsonConfiguration.Default.UseISO8601DateFormat,
maxJsonLength ?? JsonConfiguration.Default.MaxJsonLength,
maxRecursions ?? JsonConfiguration.Default.MaxRecursions,
defaultEncoding ?? JsonConfiguration.Default.DefaultEncoding,
converters ?? JsonConfiguration.Default.Converters,
primitiveConverters ?? JsonConfiguration.Default.PrimitiveConverters,
retainCasing ?? JsonConfiguration.Default.RetainCasing));
}
示例9: Cultures
/// <summary>
/// Configures <see cref="GlobalizationConfiguration"/>
/// </summary>
/// <param name="environment">An <see cref="INancyEnvironment"/> that should be configured.</param>
/// <param name="supportedCultureNames">Cultures that the application can accept</param>
/// <param name="defaultCulture">Used to set a default culture for the application</param>
/// <remarks>If defaultCulture not specified the first supported culture is used</remarks>
public static void Cultures(this INancyEnvironment environment, IEnumerable<string> supportedCultureNames, string defaultCulture = null)
{
environment.AddValue(new GlobalizationConfiguration(
supportedCultureNames: supportedCultureNames,
defaultCulture: defaultCulture));
}
示例10: AddXml
/// <summary>
/// Add a new <see cref="T:System.String"/> XML value to the current <see cref="T:Tridion.ContentManager.Templating.Package" />
/// </summary>
/// <param name="package"><see cref="T:Tridion.ContentManager.Templating.Package" /></param>
/// <param name="name">Name.</param>
/// <param name="value">Value.</param>
/// <remarks>An XML processing instruction is automatically added if required.</remarks>
public static void AddXml(this Package package, String name, String value)
{
if (package != null)
{
String packageValue = value;
// Add an XML prolog to ensure a valid XML snippet
if (!packageValue.StartsWith("<?xml", StringComparison.OrdinalIgnoreCase))
packageValue = String.Format("<?xml version=\"1.0\" encoding=\"{0}\"?>\n", Encoding.UTF8.HeaderName) + packageValue;
package.AddValue(ContentType.Xml, name, packageValue);
}
}
示例11: AddDateTime
/// <summary>
/// Add a new <see cref="T:System.DateTime"/> value to the current <see cref="T:Tridion.ContentManager.Templating.Package" />
/// </summary>
/// <param name="package"><see cref="T:Tridion.ContentManager.Templating.Package" /></param>
/// <param name="name">Name.</param>
/// <param name="value">Value.</param>
public static void AddDateTime(this Package package, String name, DateTime value)
{
if (package != null)
package.AddValue(ContentType.DateTime, name, value.ToString());
}
示例12: AddNumber
/// <summary>
/// Add a new <see cref="T:System.Double"/> value to the current <see cref="T:Tridion.ContentManager.Templating.Package" />
/// </summary>
/// <param name="package"><see cref="T:Tridion.ContentManager.Templating.Package" /></param>
/// <param name="name">Name.</param>
/// <param name="value">Value.</param>
public static void AddNumber(this Package package, String name, double value)
{
if (package != null)
package.AddValue(ContentType.Number, name, value.ToString());
}
示例13: AddXhtml
/// <summary>
/// Add a new <see cref="T:System.String"/> XHTML value to the current <see cref="T:Tridion.ContentManager.Templating.Package" />
/// </summary>
/// <param name="package"><see cref="T:Tridion.ContentManager.Templating.Package" /></param>
/// <param name="name">Name.</param>
/// <param name="value">Value.</param>
public static void AddXhtml(this Package package, String name, String value)
{
if (package != null)
package.AddValue(ContentType.Xhtml, name, value);
}
示例14: SetOptionsSyntheticMargin
internal static void SetOptionsSyntheticMargin(this Security security, decimal value)
{
security.AddValue(SecurityOptionsSyntheticMargin, value);
}
示例15: SetEvMultiplier
internal static void SetEvMultiplier(this ExecutionMessage trade, decimal multiplier)
{
trade.AddValue(_evMultiplier, multiplier);
}