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

  • Home
  • SEARCH
  • 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 6669935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:12:34+00:00 2026-05-26T03:12:34+00:00

In a C# (visual Studio 2010) project, I have a class with large number

  • 0

In a C# (visual Studio 2010) project, I have a class with large number of properties, and I populate objects of this class with data and add to list object to pass it to display list of items (Something like results of a search).
My problem is there I don’t need all the properties of the class to display the above list, so do I have to create another class only with required field to display the (results) list? Is it correct according to the OOP concepts?

  • 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-26T03:12:34+00:00Added an answer on May 26, 2026 at 3:12 am

    Your properties object can implement multiple interfaces, as requested by different parts of your program.

    If you define these interfaces:

    public interface IBasicInfo
    {
        string Name { get; }
        string Id { get; }
    }
    
    internal interface IFullInfo : IBasicInfo
    {
        string Address { get; }
    }
    
    internal interface IInternalStuff
    {
        Stuff Data { get; }
    }
    

    And your properties class implements them like this:

    internal class Properties : IFullInfo, IInternalStuff
    {
        // some basic implementation
    }
    

    Then you can pass this class to a different part of your app which has a method like this:

    public void Display(IBasicInfo info)
    {
       ...
    }
    

    And the calling code will only see properties which belong to IBasicInfo. Note that only IBasicInfo needs to be public, and even the Properties class is internal to ensure that no calling code can cast back to the actual implementation and mess with it.

    Alternatively, if your calling code contains completely different interfaces, then it is perfectly reasonable to convert them into Data Transfer Objects, and even modify their contents to match caller’s expectations (adapter pattern). There are tools which automate this task (Automapper, for example).

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

Sidebar

Related Questions

I have create a LINQ-to-SQL project in Visual Studio 2010 using Dynamic Data. In
I have a Website Project in Visual Studio 2010 along with a Class Library
I have an Visual Studio 2010 ASP.Net project. And I want to deploy this
I have a semi-large C# .exe project in visual studio 2010 Ultimate, and I
In my Visual Studio 2010 project I have files with .mm file extension, that
Has anyone migrated a VB6 project to .Net with Visual Studio 2010? I have
When I add a service reference to my Visual Studio 2010 C# project, a
In Visual Studio 2010, I have project A (asp.net application). Project A references project
I have a C# project that I have created in Visual Studio Express 2010.
I have a Visual Studio 2010 project done on MFC. I receive these errors:

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.