コード例 #1
0
        public ProtoXamlInstruction NamespacePrefixDeclaration(string prefix, string ns)
        {
            if (PrefixRegistrationMode == PrefixRegistrationMode.Automatic)
            {
                var prefixRegistration = new PrefixRegistration(prefix, ns);
                if (!typeContext.RegisteredPrefixes.Contains(prefixRegistration))
                {
                    typeContext.RegisterPrefix(prefixRegistration);
                }
            }

            return(new ProtoXamlInstruction
            {
                Namespace = ns,
                XamlType = null,
                NodeType = NodeType.PrefixDefinition,
                Prefix = prefix,
            });
        }