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 8641797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:37:22+00:00 2026-06-12T11:37:22+00:00

I have a class App which implements IApp interface class this IApp interface is

  • 0

I have a class App which implements IApp interface class
this IApp interface is like this

    interface IApp
    {
        string Status;
        dateTime start;
        datetime end;
    }

now i want to convert List to List by using Linq
this I can do like this

//AppClassList is a List<App>
List<IApp> result = AppClassList.ConvertAll<IApp>(o => (IApp)o);

but I want to do custom code while converting App to IApp,
like I want to set Status property depend on start and end date diffrence , suppose difference is one day then Status will be “Excellent” if two day then “Good” if three day then “OK” and so on …

Please suggest me how i can do it while converting App to IApp using C#.net

  • 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-06-12T11:37:24+00:00Added an answer on June 12, 2026 at 11:37 am
    List<IApp> result = AppClassList.ConvertAll<IApp>(o => ConvertToIApp(o));
        {
            IApp result = (IApp)o;
            TimeSpan span = result .end - result .start;
            if (span.TotalDays > 1)
            {
               result.Status = "Excellent";
            }
            return result;
        });
    

    and having this method:

    public IApp ConvertToIApp(Object element)
    {
        IApp result = (IApp)element;
        TimeSpan span = result.end - result.start;
        if (span.TotalDays > 1)
        {
            result.Status = "Excellent";
        }
        return result;
    }
    

    you could write:

    List<IApp> result = AppClassList.ConvertAll<IApp>(o => ConvertToIApp(o));
    

    or

    List<IApp> result = AppClassList.ConvertAll<IApp>(ConvertToIAppo);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this method inside an Activity which implements an ImageLoader class: public void
I have a WCF service, which implements interface PosData.ISampleService in class PosData.SampleService . The
I have a singleton class which is being used throughout the app. I am
I have a windows form app, and a class which is called Game. Let's
I have CoreData in my app, with an Entry class, which contains an NSOrderedSet
I have a Listener class which implements ViewListener (contains two methods, open, close, which
I have a singleton class in my play app. This singleton class is a
I have a customized TextView which implements the three View constructors (nb, this is
I'm facing this problem in Windows 7. First I define a class which implements
Say I have the following Backbone Router: class App.Routers.ThingsRouter extends Backbone.Router initialize: -> new

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.