private static void WriteInnerExceptions(XmlWriter writer, Exception exception, bool includeStackTrace) { var aggregated = exception as AggregateException; var innerExceptions = new List <Exception>(); if (aggregated != null) { innerExceptions.AddRange(aggregated.InnerExceptions); } if (exception.InnerException != null) { innerExceptions.Add(exception.InnerException); } if (innerExceptions.Count > 0) { int endElementsToWrite = 0; foreach (var inner in innerExceptions) { Type exceptionType = inner.GetType(); writer.WriteStartElement(XmlUtility.SanitizeElementName(exceptionType.Name)); writer.WriteAttributeString("namespace", exceptionType.Namespace); WriteExceptionCore(writer, inner, includeStackTrace); endElementsToWrite++; } LoopUtility.For(endElementsToWrite, WriteEndElement, writer); } }
private static void WriteInnerExceptions(JsonWriter writer, Exception exception, bool includeStackTrace) { var aggregated = exception as AggregateException; var innerExceptions = new List <Exception>(); if (aggregated != null) { innerExceptions.AddRange(aggregated.InnerExceptions); } if (exception.InnerException != null) { innerExceptions.Add(exception.InnerException); } if (innerExceptions.Count > 0) { int endElementsToWrite = 0; foreach (var inner in innerExceptions) { writer.WritePropertyName("inner", () => DynamicJsonConverter.UseCamelCase); Type exceptionType = inner.GetType(); writer.WriteStartObject(); writer.WritePropertyName("type", () => DynamicJsonConverter.UseCamelCase); writer.WriteValue(exceptionType.FullName); WriteExceptionCore(writer, inner, includeStackTrace); endElementsToWrite++; } LoopUtility.For(endElementsToWrite, WriteEndElement, writer); } }
/// <summary> /// Initializes an implementation of the <see cref="T:System.Security.Cryptography.HashAlgorithm" /> class. /// </summary> public override sealed void Initialize() { lock (Sync) { LookupTableKey = GetType().Name; HashCoreResult = DefaultSeed; InitializePolynomial(); if (LookupTable.Count == 256) { return; } LoopUtility.For <ushort>(256, InitializeLookupTable); } }
private void InitializeLookupTable(ushort tableIndex) { LoopUtility.For <byte, ushort>(8, InitializePolynomialLookupTable, tableIndex); }