예제 #1
0
        /// <summary>
        /// Creates a property definition from a property metadata row.
        /// </summary>
        /// <param name="parentModule">The module that contains the property.</param>
        /// <param name="token">The token to initialize the property for.</param>
        /// <param name="row">The metadata table row to base the property definition on.</param>
        public SerializedPropertyDefinition(SerializedModuleDefinition parentModule, MetadataToken token, PropertyDefinitionRow row)
            : base(token)
        {
            _parentModule = parentModule ?? throw new ArgumentNullException(nameof(parentModule));
            _row          = row;

            Attributes = row.Attributes;
        }
예제 #2
0
        /// <summary>
        /// Allocates metadata rows for the provided property definitions in the buffer.
        /// </summary>
        /// <param name="properties">The properties to define.</param>
        public void DefineProperties(IEnumerable <PropertyDefinition> properties)
        {
            var table = Metadata.TablesStream.GetTable <PropertyDefinitionRow>(TableIndex.Property);

            foreach (var property in properties)
            {
                var row = new PropertyDefinitionRow(
                    property.Attributes,
                    Metadata.StringsStream.GetStringIndex(property.Name),
                    Metadata.BlobStream.GetBlobIndex(this, property.Signature, DiagnosticBag));

                var token = table.Add(row);
                _tokenMapping.Register(property, token);
            }
        }