private void AppendProperties(LoggerFormatter formatter, T state, bool scoped = false) { bool propertyFound = false; int count = state.Count; for (int i = 0; i < count;) { var pair = state[i]; i++; if (i == count) { // last property if (pair.Key == "{OriginalFormat}") { break; } } if (!propertyFound) { if (scoped) { formatter.BeginScope(); } formatter.BeginProperties(); propertyFound = true; } formatter.AppendProperty(pair.Key, pair.Value); } if (propertyFound) { formatter.CloseProperties(); if (scoped) { formatter.CloseScope(); } } }