System.Data.SqlTypes.SqlXml.CreateSqlXmlReader C# (CSharp) Method

CreateSqlXmlReader() static private method

static private CreateSqlXmlReader ( Stream stream, bool closeInput = false, bool throwTargetInvocationExceptions = false ) : XmlReader
stream System.IO.Stream
closeInput bool
throwTargetInvocationExceptions bool
return XmlReader
        internal static XmlReader CreateSqlXmlReader(Stream stream, bool closeInput = false, bool throwTargetInvocationExceptions = false)
        {
            // Call the internal delegate
            XmlReaderSettings settingsToUse = closeInput ? s_defaultXmlReaderSettingsCloseInput : s_defaultXmlReaderSettings;
            try
            {
                return s_sqlReaderDelegate(stream, settingsToUse, null);
            }
            // For particular callers, we need to wrap all exceptions inside a TargetInvocationException to simulate calling CreateSqlReader via MethodInfo.Invoke
            catch (Exception ex)
            {
                if ((!throwTargetInvocationExceptions) || (!ADP.IsCatchableExceptionType(ex)))
                {
                    throw;
                }
                else
                {
                    throw new TargetInvocationException(ex);
                }
            }
        }