Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 958629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:53:51+00:00 2026-05-16T00:53:51+00:00

I have created the following class. However, I cannot get past the error: Must

  • 0

I have created the following class. However, I cannot get past the error:

Must declare a body becase it is not marked abstract, extern or partial

The classe is as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.CompilerServices;

namespace VDSORDAL
{
        public abstract class ObjectComparer<T> : IComparer<T>
        {
            public ObjectComparer(string compareField, string direction);

            private string compareField; 

            public string CompareField 
            { 
                get { return compareField; } 
                set { compareField = value; } 
            }

            public string Direction
            { 
                get { return compareField; } 
                set { compareField = value;} 
            }

            public abstract int Compare(T x, T y);
        }
}

Can someone point out the error in my ways and also give me a brief explanation as to what I am doing wrong and why it is throwing this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:53:52+00:00Added an answer on May 16, 2026 at 12:53 am

    You need to add a method body for

    public ObjectComparer(string compareField, string direction);
    

    I’d suggest that you do some research into abstract classes. MSDN is a good starting point, but a quick Google search will find you many sources of in depth information.


    Since the question has been reasonably answered I’ll add some extra comments as the code you have been given looks quite broken.

    using System.Web;
    using System.Runtime.CompilerServices;
    

    These seem to be a odd couple of namespaces to be using in a comparer (especially the second), is this class from a larger file and you haven’t got all of it, or is it just left over legacy code?


    public ObjectComparer(string compareField, string direction);
    

    I’m guessing the constructor should be setting up the properties like this?

    public ObjectComparer(string compareField, string direction)
    {
        CompareField = compareField;
        Direction = direction;
    }
    

    public string Direction
    { 
        get { return compareField; } 
        set { compareField = value;} 
    }
    

    I think this should have it’s own backing field. Seems strange that it will always be the same as CompareField.


    I don’t mean to be rude, but just getting past that error won’t make this class work. You really need to understand what it is you are trying to do and how a class like this may help you do it. (If you know all this and just didn’t understand the error then I apologise)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ExpenseType object that I have created with the following migration: class
I have created UITableCellView class called NoteCell . The header defines the following: #import
In short, I get following error: QObject::connect: Cannot queue arguments of type 'cv::Mat' (Make
Long ago I have created a following template so that I get an assert
I have an the following class I'm trying to create a list of with
I have the following code that creates a serverside object of the xmlhttp class.
I have created following rule in the .htaccess file located at the root of
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have created the following C library for reading an image: typedef struct {
I have created the following project structure for my new asp.net mvc project any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.