RaoulCode
RaoulCode

Reputation: 1

Error 1 The modifier 'abstract' is not valid for this item

I'm trying to build my C# project, I get the error:

The modifier 'abstract' is not valid for this item

In the following Interface:

namespace program.Drawing.Fields
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;

    public interface IFieldHolder
    {
        abstract event FieldChangedEventHandler FieldChanged;

        void AddField(Field field);
        Field GetField(FieldType fieldType);
        List<Field> GetFields();
        bool HasField(FieldType fieldType);
        void RemoveField(Field field);
        void SetFieldValue(FieldType fieldType, object value);
    }
}

The item: FieldChanged;

The modifier 'abstract' is not valid for this item

Upvotes: 0

Views: 1358

Answers (2)

Chris Keller
Chris Keller

Reputation: 253

I'm not sure what you are trying to do here but you may find the following information helpful:

"Interfaces and interface members are abstract; interfaces do not provide a default implementation."

Interfaces (C# Programming Guide)

That is to say, members of an Interface are implicitly abstract.

Upvotes: 0

Steve Py
Steve Py

Reputation: 34908

Interfaces by definition are abstract in that implementing classes must fulfil them. You cannot use the abstract keyword inside them. (Same goes for scoping)

Upvotes: 4

Related Questions