private void AttachProperties(IPropertyCollection properties, IContext context) { if (isReadOnly) { properties.MakeReadOnly(); } lock (padlock) { if (propertiesPerContext.Keys.Contains(context)) { throw new ArgumentException("The context for the attached PropertyCollection is already attached."); } propertiesPerContext.Add(context, properties); } }