0

I am puzzled on how to get a specific info from an IEnumerable<object>.

My application back end provides an IEnumerable<object> which contains a collection of these two properties.

int id 
string chronik

for GUI usage I want to select the string property only

I tried this:

//creating objects
backend be = new backend();
chronikDTO cronDTO = new chronikDTO();
be.getallchronik(cronDTO); //calling DB-query via Entityframework
string[] cronarry = new string[] {};

for (int x=0; x <= cronDTO.chronik.count(); x++)
{
    cronarry[x] = cronDTO.chronik.select(y => y.cron.tostring());
}

but this doesn't lead to a usable result. I've not written a new method which queries only the string property from the database, in case in other use cases I need both properties.


Firebase Callbacks - what's the underlying trigger?

I understand that in Firebase I can register my page for callbacks with the "on" method.

According to their docs:

on( ) is used to listen for data changes at a particular location. This is the primary way to read data from Firebase.

firebaseRef.on('value', function(dataSnapshot) {
  // code to handle new value.
});

My question is:

How does it work ?

How does it know that something has changed on the serverside ?

(better) How does the server can 'callback' the browser ?

One answer might be that it is "polling". But I have seen no reference about this approach in Firebase documentation or properties to configure polling time ...

Does anybody know ?

Many Thanks

4

1 回答 1

4

听起来你可能只是在追求类似的东西:

List<string> data = cronDTO.chronik
                           .OfType<Foo>()
                           .Select(x => x.chronik)
                           .ToList();

Foo你的实际类型叫什么。)

如果每个元素实际上都是一个Foo,则可以使用Cast<Foo>()代替OfType<Foo>()

于 2013-09-05T14:26:16.330 回答