public IDependencyFingerprintProtocol ReadProtocol() { bool hasValue = ReadBool(); if (hasValue) { int typeId = ReadInt(); var protocol = registry.Create(typeId); protocol.Load(this); return protocol; } else { return null; } }