Solved

c# asp.net

Posted on 2011-03-02
4
236 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now