Solved

c# asp.net

Posted on 2011-03-02
4
238 Views
Last Modified: 2012-06-27
Hi experts,

I'm sure this is a simple one, but why does my following code get the error:
IFactory<E,D>.UpdateEntity(E, D)': interface members cannot have a definition..??


 public interface IFactory<E, D> where E : EntityBase where D:IDto
    {
        // update an entity with a populated Dto
        void UpdateEntity( E e , D d ) { }

        // update a dto with a populated entity
        void UpdateDto ( E e , D d ) { }

        // make an entity from an existing dto
        E MakeEntity (E e, D d) { }

        // make a dto from an existing entity
        D MakeDto( E e , D d ) { }
    }
0
Comment
Question by:critto
4 Comments
 
LVL 8

Expert Comment

by:crysallus
ID: 35017144
Replace your curly braces with a semi-colon:

public interface IFactory<E, D> where E : EntityBase where D:IDto
    {
        // update an entity with a populated Dto
        void UpdateEntity( E e , D d );

        // update a dto with a populated entity
        void UpdateDto ( E e , D d );

        // make an entity from an existing dto
        E MakeEntity (E e, D d);

        // make a dto from an existing entity
        D MakeDto( E e , D d );
    }

Open in new window

0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 35017153
change interface to:
 public interface IFactory<E, D> where E : EntityBase where D:IDto
    {
        // update an entity with a populated Dto
        void UpdateEntity( E e , D d );

        // update a dto with a populated entity
        void UpdateDto ( E e , D d );

        // make an entity from an existing dto
        E MakeEntity (E e, D d) ;

        // make a dto from an existing entity
        D MakeDto( E e , D d );
    }
0
 

Author Comment

by:critto
ID: 35017155
Yep. Just realised that too. Muppet.

Cheers.
0
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35017161
You are right. interface members cannot have a definition.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question