MongoDB.Bson.IO.BsonWriter.ThrowInvalidContextType C# (CSharp) 메소드

ThrowInvalidContextType() 보호된 메소드

Throws an InvalidOperationException when the method called is not valid for the current ContextType.
protected ThrowInvalidContextType ( string methodName, ContextType actualContextType ) : void
methodName string The name of the method.
actualContextType ContextType The actual ContextType.
리턴 void
        protected void ThrowInvalidContextType(
            string methodName,
            ContextType actualContextType,
            params ContextType[] validContextTypes)
        {
            var validContextTypesString = string.Join(" or ", validContextTypes.Select(c => c.ToString()).ToArray());
            var message = string.Format(
                "{0} can only be called when ContextType is {1}, not when ContextType is {2}.",
                methodName, validContextTypesString, actualContextType);
            throw new InvalidOperationException(message);
        }