Example #1
0
        /// <summary>
        /// Default ctor
        /// </summary>
        public static IEnumerable<FieldBuilder> Create(AssemblyCompiler compiler, FieldDefinition field)
        {
            if (field.IsAndroidExtension())
                return new[] {new DexImportFieldBuilder(compiler, field)};
            if (field.DeclaringType.IsEnum)
            {
                if (!field.IsStatic)
                    throw new ArgumentException("value field should not be implemented this way");
                return new[] {new EnumFieldBuilder(compiler, field)};
            }

            var fieldBuilder = new FieldBuilder(compiler, field);
            if (!field.IsUsedInInterlocked)
                return new[] { fieldBuilder };

            return new[] { fieldBuilder, new FieldInterlockedBuilder(compiler, field, fieldBuilder) };
        }