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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:04:28+00:00 2026-05-21T20:04:28+00:00

For the sake of post processing on a method, I want to import an

  • 0

For the sake of “post processing” on a method, I want to import an extra function into a method.

How can I import a Func that returns an anonymous Type as a parameter for a .Select extension method?

The expression is anounymous like:

p => new
{
    ThumnailUrl = p.PicasaEntry.Media.Thumbnails[0].Attributes["url"],
    ImageUrl = p.PhotoUri
}

and needs to be used at parameter ????? and performed at .Select(?????)

private void BindControl<T, U>(string uri, DataBoundControl target, ?????)
    where T : KindQuery, new()
    where U : PicasaEntity, new()
{
    PicasaFeed feed = CreateFeed<T>(uri);
    albumList.DataSource = GetPicasaEntries<U>(feed).Select(?????);
    albumList.DataBind();
}

update:

finally I want to call it like:

    string albumUri = PicasaQuery.CreatePicasaUri(PicasaUserID, PicasaAlbumID);
    BindControls<AlbumQuery, Album>(albumUri, albumList, ?????);

    string photoUri = PicasaQuery.CreatePicasaUri(PicasaUserID, PicasaAlbumID);
    BindControls<PhotoQuery, Photo>(photoUri, slideShow, ?????);

the other methods are like:

private PicasaFeed CreateFeed<T>(string uri) 
   where T : KindQuery, new()
{
    PicasaFeed feed = null;

    try
    {
        PicasaService service = new PicasaService(PicasaApplicationName);
        T query = new T();
        query.BaseAddress = uri;
        feed = service.Query(query);
    }
    catch (Exception ex)
    {
        //exception handling not shown
    }

    return feed;
}



private IEnumerable<T> GetPicasaEntries<T>(PicasaFeed feed) 
     where T : PicasaEntity, new()
{
    if(feed == null){
        return null;
    }

    IEnumerable<T> entries = null;
    string cacheKey = feed.Id.ToString();

    if(Cache.Get(cacheKey) == null)
    {
        entries = feed.Entries.Select(x => new T() { AtomEntry = x }).ToList();
    Cache.Insert(cacheKey, entries, 
              null, Cache.NoAbsoluteExpiration, new TimeSpan(0,20,0));
    }

    return entries;
}
  • 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-21T20:04:29+00:00Added an answer on May 21, 2026 at 8:04 pm

    Anonymous types are really only designed for local use. In a strongly typed language types that can’t be strongly typed are not really encouraged for general use… They are just a part of c#s little dance in the dynamic world.

    You have two choices.

    Create a strong type.

      class Entry
      {
        public string ThumnailUrl { get; set; }
        public string ImageUrl { get; set; }
      }
    

    And then use :

      p => new Entry 
      {
         ThumnailUrl = p.PicasaEntry.Media.Thumbnails[0].Attributes["url"],
         ImageUrl = p.PhotoUri
      }
    

    Or refer to it as Object. Then use reflection to get the data out – I wouldn’t recommend this.

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

Sidebar

Related Questions

I have a inefficiently constructed form that is obviously sending one type of data
Most programmers agree that garbage collection is a great thing, and in most applications
This is a design question. I'm trying to decide between 2 implementations. In order
I have 3 forms at the same page and each has a different form
I'm implementing a REST API using ASP.NET MVC, and a little stumbling block has
I think this is a common issue. Whenever there is a form on a
I have a WebPage on which I have to detect and prevent usage of
I am struggling with a creating a query. It is related to a large
We are looking at using a library to help us detect SQL injections. We
I'm on SQL Server 2005 and I am getting an error which I am

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.