string.Format(System.IFormatProvider, string, params object[])

Here are the examples of the csharp api class string.Format(System.IFormatProvider, string, params 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: vr-studies
Source File: RoomInfo.cs
View license
public string ToStringFull()
    {
        return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount, this.customPropertiesField.ToStringFull());
    }

2. Example

Project: vr-studies
Source File: CircularDrive.cs
View license
private void UpdateDebugText()
		{
			if ( debugText )
			{
				debugText.text = string.Format( "Linear: {0}\nAngle:  {1}\n", linearMapping.value, outAngle );
			}
		}

3. Example

Project: vr-studies
Source File: Room.cs
View license
public new string ToStringFull()
    {
        return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount, this.CustomProperties.ToStringFull());
    }

4. Example

View license
public override string Format(string viewName, string controllerName, string areaName, string theme) {
                return string.Format(CultureInfo.InvariantCulture, virtualPathFormatString, viewName, controllerName, areaName, theme);
            }

5. Example

View license
static ApplicationException AppExcept (string message, params object [] args)
		{
			return new ApplicationException (String.Format (
				CultureInfo.InvariantCulture, message, args));
		}

6. Example

Project: spartacus-csharp
Source File: Platform.cs
View license
static uint GetGid (string group)
		{
			var info = new UnixGroupInfo (group);
			var gid = info.GroupId;
			if (gid > UInt32.MaxValue || gid <= 0)
				throw new ArgumentOutOfRangeException ("group", String.Format ("Gid for {0} ({1}) not in range for sgid", group, gid));
			return (uint)gid;
		}

7. Example

Project: knight
Source File: MongoDBCRAuthenticator.cs
View license
private MongoAuthenticationException CreateException(IConnection connection, Exception ex)
        {
            var message = string.Format("Unable to authenticate username '{0}' on database '{1}'.", _credential.Username, _credential.Source);
            return new MongoAuthenticationException(connection.ConnectionId, message, ex);
        }

8. Example

View license
private static string FormatMessage(ConnectionId connectionId, long cursorId)
        {
            return string.Format(
                "Cursor {0} not found on server {1} using connection {2}.",
                cursorId,
                EndPointHelper.ToString(connectionId.ServerId.EndPoint),
                connectionId.ServerValue);
        }

9. Example

Project: knight
Source File: Ensure.cs
View license
public static TimeSpan IsInfiniteOrGreaterThanZero(TimeSpan value, string paramName)
        {
            if (value == Timeout.InfiniteTimeSpan || value > TimeSpan.Zero)
            {
                return value;
            }
            var message = string.Format("Value is not infinite or greater than zero: {0}.", TimeSpanParser.ToString(value));
            throw new ArgumentOutOfRangeException(paramName, message);
        }

10. Example

Project: knight
Source File: DefaultIfEmptyExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.DefaultIfEmpty()", _source.ToString());
        }

11. Example

Project: knight
Source File: ZipExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Zip({1})", _source.ToString(), _other.ToString());
        }

12. Example

Project: knight
Source File: SampleExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Sample({1})", _source.ToString(), _count.ToString());
        }

13. Example

Project: knight
Source File: WhereExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Where({1})", _source.ToString(), _predicate.ToString());
        }

14. Example

Project: knight
Source File: System_String_Binding.cs
View license
static StackObject* Format_97(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack,/n ..... /n //View Source file for more details /n }

15. Example

Project: knight
Source File: MethodHelper.cs
View license
public static MethodInfo GetMethodInfo<T, TResult>(Expression<Func<T, TResult>> lambda)
        {
            Ensure.IsNotNull(lambda, nameof(lambda));

            switch (lambda.Body.NodeType)
            {
                case ExpressionType.Call:
                    return ((MethodCallExpression)lambda.Body).Method;
            }

            throw new MongoInternalException(string.Format("Unable to extract method info from {0}", lambda.Body.ToString()));
        }

16. Example

Project: knight
Source File: Debugger.cs
View license
public static void ValidValueE<T>(T value, string format, params object[] args)
            where T : class
        {
            if(null == value)
                throw new UnityException(string.Format(null, format, args));
        }

17. Example

Project: knight
Source File: FieldDefinition.cs
View license
public override RenderedFieldDefinition<TField> Render(IBsonSerializer<TDocument> documentSerializer, IBsonSerializerRegistry serializerRegistry)
        {
            var lambda = (LambdaExpression)PartialEvaluator.Evaluate(_expression);
            var bindingContext = new PipelineBindingContext(serializerRegistry);
            var parameterExpression = new DocumentExpression(documentSerializer);
            bindingContext.AddExpressionMapping(lambda.Parameters[0], parameterExpression);
            var bound = bindingContext.Bind(lambda.Body);
            bound = FieldExpressionFlattener.FlattenFields(bound);
            IFieldExpression field;
            if (!Linq.ExpressionHelper.TryGetExpression(bound, out field))
            {
                var message = string.Format("Unable to determine the serialization information for {0}.", _expression);
                throw new InvalidOperationException(message);
            }

            var underlyingSerializer = field.Serializer;
            var fieldSerializer = underlyingSerializer as IBsonSerializer<TField>;
            var valueSerializer = (IBsonSerializer<TField>)FieldValueSerializerHelper.GetSerializerForValueType(underlyingSerializer, serializerRegistry, typeof(TField));

            return new RenderedFieldDefinition<TField>(field.FieldName, fieldSerializer, valueSerializer, underlyingSerializer);
        }

18. Example

Project: knight
Source File: ServerId.cs
View license
public override string ToString()
        {
            return string.Format("{{ ClusterId : {0}, EndPoint : \"{1}\" }}", _clusterId, _endPoint);
        }

19. Example

Project: knight
Source File: UnionExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Union({1})", _source.ToString(), _other.ToString());
        }

20. Example

Project: knight
Source File: TakeExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Take({1})", _source.ToString(), _count.ToString());
        }

21. Example

Project: knight
Source File: AccumulatorExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}({1})", _accumulatorType.ToString(), _argument == null ? "" : _argument.ToString());
        }

22. Example

Project: knight
Source File: Ensure.cs
View license
public static TimeSpan IsInfiniteOrGreaterThanOrEqualToZero(TimeSpan value, string paramName)
        {
            if (value < TimeSpan.Zero && value != Timeout.InfiniteTimeSpan)
            {
                var message = string.Format("Value is not infinite or greater than or equal to zero: {0}.", TimeSpanParser.ToString(value));
                throw new ArgumentOutOfRangeException(paramName, message);
            }
            return value;
        }

23. Example

Project: knight
Source File: GetMoreWireProtocol.cs
View license
private CursorBatch<TDocument> ProcessReply(ConnectionId connectionId, ReplyMessage<TDocument> reply)
        {
            if (reply.CursorNotFound)
            {
                throw new MongoCursorNotFoundException(connectionId, _cursorId, _query);
            }

            if (reply.QueryFailure)
            {
                var failureDocument = reply.QueryFailureDocument;
                var errorMessage = string.Format("GetMore QueryFailure: {0}.", failureDocument);
                throw ExceptionMapper.Map(connectionId, failureDocument) ?? new MongoQueryException(connectionId, errorMessage, _query, failureDocument);
            }

            return new CursorBatch<TDocument>(reply.CursorId, reply.Documents);
        }

24. Example

Project: knight
Source File: GroupByExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.GroupBy({1})", _source.ToString(), _keySelector.ToString());
        }

25. Example

Project: knight
Source File: Debugger.cs
View license
public static void AssertE(bool bCondition, string format, params object[] args)
        {
            if (!bCondition)
                throw new UnityException(string.Format(null, format, args));
        }

26. Example

Project: knight
Source File: IntersectExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Intersect({1})", _source.ToString(), _other.ToString());
        }

27. Example

Project: knight
Source File: Ensure.cs
View license
public static TimeSpan? IsNullOrInfiniteOrGreaterThanOrEqualToZero(TimeSpan? value, string paramName)
        {
            if (value.HasValue && value.Value < TimeSpan.Zero && value.Value != Timeout.InfiniteTimeSpan)
            {
                var message = string.Format("Value is not null or infinite or greater than or equal to zero: {0}.", TimeSpanParser.ToString(value.Value));
                throw new ArgumentOutOfRangeException(paramName, message);
            }
            return value;
        }

28. Example

Project: knight
Source File: TraceSourceEventHelper.cs
View license
public static string Label(ClusterId clusterId)
        {
            return string.Format("cluster[{0}]", clusterId.Value.ToString());
        }

29. Example

Project: knight
Source File: ConcatExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Concat({1})", _source.ToString(), _other.ToString());
        }

30. Example

View license
public override string ToString()
        {
            return string.Format("{0}.GroupBy({1})", _source.ToString(), _selector.ToString());
        }

31. Example

Project: knight
Source File: ConnectionId.cs
View license
public override string ToString()
        {
            if (_serverValue == null)
            {
                return string.Format("{{ ServerId : {0}, LocalValue : {1} }}", _serverId, _localValue);
            }
            else
            {
                return string.Format("{{ ServerId : {0}, LocalValue : {1}, ServerValue : \"{2}\" }}", _serverId, _localValue, _serverValue);
            }
        }

32. Example

Project: knight
Source File: PipelineBinder.cs
View license
protected override Expression BindNonMethodCall(Expression node)
        {
            if (node.NodeType == ExpressionType.Constant &&
                node.Type.GetTypeInfo().IsGenericType &&
                node.Type.GetGenericTypeDefinition() == typeof(IMongoQueryable<>))
            {
                var queryable = (IMongoQueryable)((ConstantExpression)node).Value;
                var provider = (IMongoQueryProvider)queryable.Provider;
                return new PipelineExpression(
                    new CollectionExpression(provider.CollectionNamespace, provider.CollectionDocumentSerializer),
                    new DocumentExpression(provider.CollectionDocumentSerializer));
            }

            var message = string.Format("The expression tree is not supported: {0}",
                            node.ToString());

            throw new NotSupportedException(message);
        }

33. Example

Project: knight
Source File: SelectManyExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.SelectMany({1})", _source.ToString(), _resultSelector.ToString());
        }

34. Example

Project: knight
Source File: ExceptExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Except({1})", _source.ToString(), _other.ToString());
        }

35. Example

View license
public override string ToString()
        {
            return string.Format("ReadPreferenceServerSelector{{ ReadPreference = {0} }}", _readPreference);
        }

36. Example

View license
private static string FormatMessage(ClusterDescription clusterDescription)
        {
            return string.Format(
                "This version of the driver is not compatible with one or more of the servers to which it is connected: {0}.",
                clusterDescription);
        }

37. Example

Project: knight
Source File: FieldDefinition.cs
View license
public override RenderedFieldDefinition Render(IBsonSerializer<TDocument> documentSerializer, IBsonSerializerRegistry serializerRegistry)
        {
            var bindingContext = new PipelineBindingContext(serializerRegistry);
            var lambda = ExpressionHelper.GetLambda(PartialEvaluator.Evaluate(_expression));
            var parameterExpression = new DocumentExpression(documentSerializer);
            bindingContext.AddExpressionMapping(lambda.Parameters[0], parameterExpression);
            var bound = bindingContext.Bind(lambda.Body);
            bound = FieldExpressionFlattener.FlattenFields(bound);
            IFieldExpression field;
            if (!ExpressionHelper.TryGetExpression(bound, out field))
            {
                var message = string.Format("Unable to determine the serialization information for {0}.", _expression);
                throw new InvalidOperationException(message);
            }

            return new RenderedFieldDefinition(field.FieldName, field.Serializer);
        }

38. Example

Project: knight
Source File: MongoCredential.cs
View license
public override string ToString()
        {
            return string.Format("{0}@{1}", _identity.Username, _identity.Source);
        }

39. Example

Project: knight
Source File: SelectExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Select({1})", _source.ToString(), _selector.ToString());
        }

40. Example

Project: knight
Source File: SkipExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Skip({1})", _source.ToString(), _count.ToString());
        }

41. Example

Project: knight
Source File: DistinctExpression.cs
View license
public override string ToString()
        {
            return string.Format("{0}.Distinct()", _source.ToString());
        }

42. Example

Project: knight
Source File: System_String_Binding.cs
View license
static StackObject* Format_99(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 3);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Object[] args = (System.Object[])typeof(System.Object[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.String format = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.IFormatProvider provider = (System.IFormatProvider)typeof(System.IFormatProvider).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = System.String.Format(provider, format, args);

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

43. Example

View license
internal static MongoWaitQueueFullException ForConnectionPool(EndPoint endPoint)
        {
            var message = string.Format(
                "The wait queue for acquiring a connection to server {0} is full.",
                EndPointHelper.ToString(endPoint));
            return new MongoWaitQueueFullException(message);
        }

44. Example

Project: knight
Source File: PlainAuthenticator.cs
View license
public ISaslStep Initialize(IConnection connection, ConnectionDescription description)
            {
                Ensure.IsNotNull(connection, nameof(connection));
                Ensure.IsNotNull(description, nameof(description));

                var dataString = string.Format("\0{0}\0{1}",
                    _credential.Username,
                    _credential.GetInsecurePassword());

                var bytes = Utf8Encodings.Strict.GetBytes(dataString);
                return new CompletedStep(bytes);
            }

45. Example

Project: knight
Source File: MethodHelper.cs
View license
public static MethodInfo GetMethodInfo<TResult>(Expression<Func<TResult>> lambda)
        {
            Ensure.IsNotNull(lambda, nameof(lambda));

            switch (lambda.Body.NodeType)
            {
                case ExpressionType.Call:
                    return ((MethodCallExpression)lambda.Body).Method;
            }

            throw new MongoInternalException(string.Format("Unable to extract method info from {0}", lambda.Body.ToString()));
        }

46. Example

Project: knight
Source File: System_String_Binding.cs
View license
static StackObject* Format_98(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack,/n ..... /n //View Source file for more details /n }

47. Example

Project: knight
Source File: Ensure.cs
View license
public static TimeSpan IsGreaterThanOrEqualToZero(TimeSpan value, string paramName)
        {
            if (value < TimeSpan.Zero)
            {
                var message = string.Format("Value is not greater than or equal to zero: {0}.", TimeSpanParser.ToString(value));
                throw new ArgumentOutOfRangeException(paramName, message);
            }
            return value;
        }

48. Example

Project: knight
Source File: BsonStreamExtensions.cs
View license
public static BsonType ReadBsonType(this BsonStream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            var b = stream.ReadByte();
            if (b == -1)
            {
                throw new EndOfStreamException();
            }
            if (!__validBsonTypes[b])
            {
                var message = string.Format("Detected unknown BSON type \"\\x{0:x2}\". Are you using the latest driver version?", b);
                throw new FormatException(message);
            }
            return (BsonType)b;
        }

49. Example

Project: knight
Source File: BsonClassMap.cs
View license
private void EnsureMemberMapIsForThisClass(BsonMemberMap memberMap)
        {
            if (memberMap.ClassMap != this)
            {
                var message = string.Format(
                    "The memberMap argument must be for class {0}, but was for class {1}.",
                    _classType.Name,
                    memberMap.ClassMap.ClassType.Name);
                throw new ArgumentOutOfRangeException("memberMap", message);
            }
        }

50. Example

Project: knight
Source File: ExplainOperation.cs
View license
private static string ConvertVerbosityToString(ExplainVerbosity verbosity)
        {
            switch (verbosity)
            {
                case ExplainVerbosity.AllPlansExecution:
                    return "allPlansExecution";
                case ExplainVerbosity.ExecutionStats:
                    return "executionStats";
                case ExplainVerbosity.QueryPlanner:
                    return "queryPlanner";
                default:
                    var message = string.Format("Unsupported explain verbosity: {0}.", verbosity.ToString());
                    throw new InvalidOperationException(message);
            }
        }