string.AddUnderscores()

Here are the examples of the csharp api class string.AddUnderscores() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: stripe-dotnet
Source File: StringExtensions.cs
View license
public static IEnumerable<string> GetNameVariants(this string name, CultureInfo culture)
		{
			if (String.IsNullOrEmpty(name))
				yield break;

			yield return name;

			// try camel cased name
			yield return name.ToCamelCase(culture);

			// try lower cased name
			yield return name.ToLower(culture);

			// try name with underscores
			yield return name.AddUnderscores();

			// try name with underscores with lower case
			yield return name.AddUnderscores().ToLower(culture);

			// try name with dashes
			yield return name.AddDashes();

			// try name with dashes with lower case
			yield return name.AddDashes().ToLower(culture);
		}

2. Example

Project: RestSharp
Source File: StringExtensions.cs
View license
public static IEnumerable<string> GetNameVariants(this string name, CultureInfo culture)
        {
            if (string.IsNullOrEmpty(name))
                yield break;

            yield return name;

            // try camel cased name
            yield return name.ToCamelCase(culture);

            // try lower cased name
            yield return name.ToLower(culture);

            // try name with underscores
            yield return name.AddUnderscores();

            // try name with underscores with lower case
            yield return name.AddUnderscores().ToLower(culture);

            // try name with dashes
            yield return name.AddDashes();

            // try name with dashes with lower case
            yield return name.AddDashes().ToLower(culture);

            // try name with underscore prefix
            yield return name.AddUnderscorePrefix();

            // try name with underscore prefix, using camel case
            yield return name.ToCamelCase(culture).AddUnderscorePrefix();

            // try name with spaces
            yield return name.AddSpaces();

            // try name with spaces with lower case
            yield return name.AddSpaces().ToLower(culture);
        }