Mono.CSharp.Indexer.Define C# (CSharp) Method

Define() public method

public Define ( ) : bool
return bool
        public override bool Define()
        {
            if (!base.Define ())
                return false;

            if (!DefineParameters (parameters))
                return false;

            if (OptAttributes != null) {
                Attribute indexer_attr = OptAttributes.Search (Module.PredefinedAttributes.IndexerName);
                if (indexer_attr != null) {
                    var compiling = indexer_attr.Type.MemberDefinition as TypeContainer;
                    if (compiling != null)
                        compiling.Define ();

                    string name = indexer_attr.GetIndexerAttributeValue ();
                    if ((ModFlags & Modifiers.OVERRIDE) != 0) {
                        Report.Error (609, indexer_attr.Location,
                            "Cannot set the `IndexerName' attribute on an indexer marked override");
                    }

                    if (!string.IsNullOrEmpty (name))
                        ShortName = name;
                }
            }

            if (InterfaceType != null) {
                string base_IndexerName = InterfaceType.MemberDefinition.GetAttributeDefaultMember ();
                if (base_IndexerName != Name)
                    ShortName = base_IndexerName;
            }

            if (!Parent.PartialContainer.AddMember (this))
                return false;

            flags |= MethodAttributes.HideBySig | MethodAttributes.SpecialName;

            if (!DefineAccessors ())
                return false;

            if (!CheckBase ())
                return false;

            DefineBuilders (MemberKind.Indexer, parameters);
            return true;
        }