string.Format(System.IFormatProvider, string, object, object, object)

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

200 Examples 7

1. Example

Project: MonoGame.Extended
Source File: HslColor.cs
View license
public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "H:{0:N1} S:{1:N1} L:{2:N1}",
                H, 100*S, 100*L);
        }

2. Example

Project: carbonator
Source File: CollectedMetric.cs
View license
public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "{0} {1:0.000} {2}\n", Path, Value, Timestamp);
        }

3. Example

View license
protected override string FormatErrorMessage(string error, string name) {
            return string.Format(CultureInfo.CurrentCulture, error, name, minimum, maximum);
        }

4. Example

Project: AzureServicesForUnity
Source File: Utilities.cs
View license
public static string GetAuthorization(string accountName, string signature)
        {
            return
               string.Format(CultureInfo.InvariantCulture, "{0} {1}:{2}", "SharedKey", accountName, signature);
        }

5. Example

Project: corewf
Source File: TrackingRecord.cs
View license
public override string ToString()
        {
            return string.Format(CultureInfo.CurrentCulture,
                "InstanceId = {0}, RecordNumber = {1}, EventTime = {2}",
                this.InstanceId,
                this.RecordNumber,
                this.EventTime);
        }

6. Example

View license
private void CheckPosition(int i)
        {
            if (i > _endIndex - _writeIndex)
            {
                throw new RuntimeException(string.Format(CultureInfo.InvariantCulture, "Buffer overrun i={0};endIndex={1};writeIndex={2}", i, _endIndex, _writeIndex));
            }
        }

7. Example

View license
public override string ToString()
        {
            return String.Format(new CultureInfo("En-us"),"AspNetEngine: (ID : {0}), (Virtual Alias  : {1}), (Physical Directory : {2})", 1, m_VirtualAlias, m_PhysicalDirectory);
        }

8. Example

View license
public override string ToString()
		{
			return String.Format(System.Globalization.CultureInfo.InvariantCulture, "#{0} [{1}~{2}]", m_startedUtc.Ticks / TimeSpan.TicksPerMillisecond, m_minVersion, m_maxVersion);
		}

9. Example

View license
public override string ToString()
			{
				return String.Format(CultureInfo.InvariantCulture, "({0} ~ {1}, {2})", this.Begin, this.End, this.Value);
			}

10. Example

View license
public override string ToString()
		{
			return String.Format(CultureInfo.InvariantCulture, "Counter={0:N0}, Hz={1:N1}, Roughness={2:N2}", this.Counter, this.Hz, this.Roughness);
		}

11. Example

Project: InnovatorAdmin
Source File: DocumentLine.cs
View license
public override string ToString()
		{
			if (IsDeleted)
				return "[DocumentLine deleted]";
			else
				return string.Format(
					CultureInfo.InvariantCulture,
					"[DocumentLine Number={0} Offset={1} Length={2}]", LineNumber, Offset, Length);
		}

12. Example

Project: TQVaultAE
Source File: DBRecordCollection.cs
View license
public string ToShortString()
		{
			return string.Format(CultureInfo.CurrentCulture, "{0},{1},{2}", this.Id, this.RecordType, this.Count);
		}

13. Example

Project: TQVaultAE
Source File: Database.cs
View license
public static string HtmlColor(Color color)
		{
			return string.Format(CultureInfo.InvariantCulture, "#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
		}

14. Example

Project: LazyCopy
Source File: LazyCopyFileData.cs
View license
public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "FileSize: {0}, RemotePath: '{1}', UseCustomHandler: {2}", this.FileSize, this.RemotePath, this.UseCustomHandler);
        }

15. Example

Project: gitextensions
Source File: ISettingsSource.cs
View license
public static string AsString(this Font value)
        {
            return String.Format(CultureInfo.InvariantCulture,
                "{0};{1};{2}", value.FontFamily.Name, value.Size, InvariantCultureId);
        }

16. Example

Project: VisualStudio
Source File: Guard.cs
View license
public static void ArgumentInRange(int value, int minValue, string name)
        {
            if (value >= minValue) return;
            string message = String.Format(CultureInfo.InvariantCulture,
                "The value '{0}' for '{1}' must be greater than or equal to '{2}'",
                value,
                name,
                minValue);
            throw new ArgumentOutOfRangeException(name, message);
        }

17. Example

Project: Unity
Source File: Guard.cs
View license
public static void ArgumentInRange(int value, int minValue, string name)
        {
            if (value >= minValue) return;
            string message = String.Format(CultureInfo.InvariantCulture,
                "The value '{0}' for '{1}' must be greater than or equal to '{2}'",
                value,
                name,
                minValue);
            throw new ArgumentOutOfRangeException(name, message);
        }

18. Example

Project: uSignalR
Source File: Connection.cs
View license
private static string CreateUserAgentString(string client)
        {
            if (_assemblyVersion == null)
                _assemblyVersion = new AssemblyName(typeof (Connection).Assembly.FullName).Version;

            return String.Format(
                CultureInfo.InvariantCulture,
                "{0}/{1} ({2})",
                client,
                _assemblyVersion,
                Environment.OSVersion);
        }

19. Example

Project: helix-toolkit
Source File: ObjExporter.cs
View license
private string ToColorString(Color color)
        {
            return string.Format(CultureInfo.InvariantCulture, "{0:F4} {1:F4} {2:F4}", color.R / 255.0, color.G / 255.0, color.B / 255.0);
        }

20. Example

Project: helix-toolkit
Source File: KerkytheaExporter.cs
View license
private static string ToKerkytheaString(Color c)
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "{0:0.######} {1:0.######} {2:0.######}",
                c.R / 255.0,
                c.G / 255.0,
                c.B / 255.0);
        }

21. Example

Project: helix-toolkit
Source File: ObjExporter.cs
View license
private string ToColorString(Color color)
        {
            return string.Format(
                CultureInfo.InvariantCulture, "{0:F4} {1:F4} {2:F4}", color.R / 255.0, color.G / 255.0, color.B / 255.0);
        }

22. Example

Project: core
Source File: HccRazorViewEngine.cs
View license
public virtual string Format(string viewName, string controllerName, string areaName, string rootFolder)
            {
                return string.Format(CultureInfo.InvariantCulture, _virtualPathFormatString, viewName, controllerName,
                    rootFolder);
            }

23. Example

Project: openair
Source File: EntityChangeSet.cs
View license
public override string ToString()
        {
            return string.Format(
                System.Globalization.CultureInfo.CurrentCulture,
                "{{Added = {0}, Modified = {1}, Removed = {2}}}",
                this._addedEntities.Count,
                this._modifiedEntities.Count,
                this._removedEntities.Count);
        }

24. Example

Project: halcyon
Source File: Vector3.cs
View license
public string ToRawString()
        {
            CultureInfo enUs = new CultureInfo("en-us");
            enUs.NumberFormat.NumberDecimalDigits = 3;

            return String.Format(enUs, "{0} {1} {2}", X, Y, Z);
        }

25. Example

Project: halcyon
Source File: Vector3d.cs
View license
public string ToRawString()
        {
            CultureInfo enUs = new CultureInfo("en-us");
            enUs.NumberFormat.NumberDecimalDigits = 3;

            return String.Format(enUs, "{0} {1} {2}", X, Y, Z);
        }

26. Example

Project: dlr
Source File: SourceLocation.cs
View license
internal string ToDebugString() {
            return String.Format(CultureInfo.CurrentCulture, "({0},{1},{2})", _index, _line, _column);
        }

27. Example

View license
public string GetBrokerPartitionInfoAsString()
        {
            return string.Format(CultureInfo.InvariantCulture, "{0}:{1}:{2}", Id, Host, Port);
        }

28. Example

Project: forge
Source File: Tuple.cs
View license
public string ToString(string format, IFormatProvider formatProvider) {
            return string.Format(formatProvider, format ?? "({0}, {1}, {2})", Item1, Item2, Item3);
        }

29. Example

View license
public override string FormatErrorMessage(string name)
        {
            string ComparisonTypeString = "";
            switch (Type)
            {
                case ComparisonType.Equal:
                    ComparisonTypeString = "equal";
                    break;
                case ComparisonType.GreaterThan:
                    ComparisonTypeString = "greater than";
                    break;
                case ComparisonType.GreaterThanOrEqual:
                    ComparisonTypeString = "greater than or equal";
                    break;
                case ComparisonType.LessThan:
                    ComparisonTypeString = "less than";
                    break;
                case ComparisonType.LessThanOrEqual:
                    ComparisonTypeString = "less than or equal";
                    break;
                case ComparisonType.NotEqual:
                    ComparisonTypeString = "not equal";
                    break;
            }

            return string.Format(CultureInfo.InvariantCulture, ErrorMessageString, name, ComparisonTypeString, PropertyName);
        }

30. Example

View license
public override string FormatErrorMessage(string name)
        {
            string ComparisonTypeString = "";
            switch (Type)
            {
                case ComparisonType.Equal:
                    ComparisonTypeString = "equal";
                    break;
                case ComparisonType.GreaterThan:
                    ComparisonTypeString = "greater than";
                    break;
                case ComparisonType.GreaterThanOrEqual:
                    ComparisonTypeString = "greater than or equal";
                    break;
                case ComparisonType.LessThan:
                    ComparisonTypeString = "less than";
                    break;
                case ComparisonType.LessThanOrEqual:
                    ComparisonTypeString = "less than or equal";
                    break;
                case ComparisonType.NotEqual:
                    ComparisonTypeString = "not equal";
                    break;
            }

            return string.Format(CultureInfo.InvariantCulture, ErrorMessageString, name, ComparisonTypeString, PropertyName);
        }

31. Example

Project: gitter
Source File: DiffColumnHeader.cs
View license
public override string ToString()
		{
			return string.Format(System.Globalization.CultureInfo.InvariantCulture,
				"{0}{1},{2}", Action == DiffColumnAction.Add ? '+' : '-', _startLine, _lineCount);
		}

32. Example

Project: SignalR.Client.20
Source File: Connection.cs
View license
private static string CreateUserAgentString(string client)
        {
            if (m_assemblyVersion == null)
                m_assemblyVersion = new AssemblyName(typeof(Connection).Assembly.FullName).Version;

            return String.Format(
                CultureInfo.InvariantCulture, 
                "{0}/{1} ({2})", 
                client, 
                m_assemblyVersion, 
                Environment.OSVersion);
        }

33. Example

View license
public override string FormatErrorMessage(string name)
        {
            return String.Format(CultureInfo.CurrentUICulture, ErrorMessageString,
                name, _minCharacters,_maxCharacters);
        }

34. Example

Project: managedCuda
Source File: VectorTypes.cs
View license
public override string ToString()
		{
			return string.Format(CultureInfo.CurrentCulture, "({0}; {1}; {2})", this.x, this.y, this.z);
		}

35. Example

Project: managedCuda
Source File: NPPTypes.cs
View license
public override string ToString()
		{
			return string.Format(CultureInfo.CurrentCulture, "{0}.{1}.{2}", this.major, this.minor, this.build);
		}

36. Example

View license
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", Justification = "Format strings are analyzed after inlining the names of the command line parameters. Those are valid strings.")]
        private void ValidateShowDbSchemaParameter()
        {
            if (this.IsShowDbSchemaSpecified)
            {
                if (this.IsBlockchainPathSpecified || this.IsRunValidationSpecified)
                {
                    throw new InvalidParameterException(string.Format(
                        CultureInfo.InvariantCulture,
                        "Parameter /{0} cannot be specified if either of /{1} or /{2} is specified.",
                        ParameterNameShowDbSchema,
                        ParameterNameBlockchainPath,
                        ParameterNameRunValidation));
                }
            }
        }

37. Example

View license
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", Justification = "Format strings are analyzed after inlining the names of the command line parameters. Those are valid strings.")]
        private void ValidateSqlServerNameParameter()
        {
            if (this.IsSqlServerNameSpecified)
            {
                if (this.IsBlockchainPathSpecified == false && this.IsRunValidationSpecified == false)
                {
                    throw new InvalidParameterException(string.Format(
                        CultureInfo.InvariantCulture,
                        "Parameter /{0} cannot be specified in the absence of either /{1} or /{2}.",
                        ParameterNameSqlServerName,
                        ParameterNameBlockchainPath,
                        ParameterNameRunValidation));
                }
            }
        }

38. Example

View license
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", Justification = "Format strings are analyzed after inlining the names of the command line parameters. Those are valid strings.")]
        private void ValidateSqlDbNameParameter()
        {
            if (this.IsSqlDbNameSpecified)
            {
                if (this.IsBlockchainPathSpecified == false && this.IsRunValidationSpecified == false)
                {
                    throw new InvalidParameterException(string.Format(
                        CultureInfo.InvariantCulture,
                        "Parameter /{0} cannot be specified in the absence of either /{1} or /{2}.",
                        ParameterNameSqlDbName,
                        ParameterNameBlockchainPath,
                        ParameterNameRunValidation));
                }
            }
            else
            {
                if (this.IsBlockchainPathSpecified || this.IsRunValidationSpecified)
                {
                    throw new InvalidParameterException(string.Format(
                        CultureInfo.InvariantCulture,
                        "Parameter /{0} is required when parameter /{1} or /{2} is specified.",
                        ParameterNameSqlDbName,
                        ParameterNameBlockchainPath,
                        ParameterNameRunValidation));
                }
            }
        }

39. Example

Project: libgit2sharp
Source File: TarWriter.cs
View license
private static string BuildKeyValueExtHeader(string key, string value)
        {
            // "%u %s=%s\n"
            int len = key.Length + value.Length + 3;
            for (int i = len; i > 9; i /= 10)
            {
                len++;
            }

            return string.Format(CultureInfo.InvariantCulture, "{0} {1}={2}\n", len, key, value);
        }

40. Example

Project: Kamilla
Source File: Vector3.cs
View license
public string ToString(string format, IFormatProvider provider)
        {
            if (format != null)
                throw new FormatException();

            return string.Format(provider, "{{X:{0} Y:{1} Z:{2}}}", this.X, this.Y, this.Z);
        }

41. Example

Project: AngleSharp
Source File: DateInputType.cs
View license
public override String ConvertFromDate(DateTime value)
        {
            return String.Format(CultureInfo.InvariantCulture, "{0:0000}-{1:00}-{2:00}", value.Year, value.Month, value.Day);
        }

42. Example

Project: Cryengine-Converter
Source File: Vector3.cs
View license
public override string ToString()
        {
            return string.Format(CultureInfo.CurrentCulture, "{0},{1},{2}", X, Y, Z);
        }

43. Example

Project: DSInternals
Source File: jet_unicodeindex.cs
View license
public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "JET_UNICODEINDEX({0}:{1}:0x{2:X})",
                this.localeId,
                this.localeName,
                this.mapStringFlags);
        }

44. Example

Project: DSInternals
Source File: jet_tablecreate.cs
View license
public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "JET_TABLECREATE({0}:{1} columns:{2} indices)",
                this.szTableName,
                this.cColumns,
                this.cIndexes);
        }

45. Example

Project: DSInternals
Source File: Types.cs
View license
public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "JET_INDEXID(0x{0:x}:0x{1:x}:0x{2:x})",
                this.IndexId1,
                this.IndexId2,
                this.IndexId3);
        }

46. Example

Project: DSInternals
Source File: jet_lgpos.cs
View license
public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "JET_LGPOS(0x{0:X},{1:X},{2:X})",
                this.lGeneration,
                this.isec,
                this.ib);
        }

47. Example

View license
public void SkipBytes(ulong skip) {
			if (_pos + skip > _length) {
				string msg = string.Format(NumberFormatInfo.InvariantInfo, "[SkipBytes()] skip:{0} pos:{1} len:{2}", skip, _pos, _length);
				throw new System.Exception(msg);
			}
			_pos += skip;
		}

48. Example

Project: NugetCracker
Source File: ZipPackage.cs
View license
private string GetAssembliesCacheKey()
        {
            return String.Format(CultureInfo.InvariantCulture, CacheKeyFormat, AssembliesCacheKey, Id, Version);
        }

49. Example

Project: NugetCracker
Source File: ZipPackage.cs
View license
private string GetFilesCacheKey()
        {
            return String.Format(CultureInfo.InvariantCulture, CacheKeyFormat, FilesCacheKey, Id, Version);
        }

50. Example

View license
[Test]
		public void TestToString_StringifiableBinary()
		{
			var target = new MessagePackString( new byte[] { ( byte )'A', ( byte )'B', ( byte )'C' }, false );
			Assert.AreEqual( String.Format( CultureInfo.InvariantCulture, "0x{0:x}{1:x}{2:x}", ( byte )'A', ( byte )'B', ( byte )'C' ), target.ToString() );
			// Encode
			target.GetString();
			Assert.AreEqual( "ABC", target.ToString() );
		}