Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

C# - Casting-Problem

Empfohlene Antworten

Veröffentlicht

Hallo "Kollegen",

ich "steh' hier auf dem Schlauch" - vielleicht kann mir jemand helfen .. ist zwar nicht "überlebenswichtig", doch würde mich das schon interessieren. Ausgangspunkt ist, dass ich eine Collection habe und eine IListe und möchte die auf "eins" casten, wie mache ich das (vorausgesetzt es ist möglich) .. ich möchte nicht zweimal die gleiche Schleife schreiben.

1. Collection ist vom Typ IHTMLElementCollection (Inhalt IHTMLElement)

2. IList<IHTMLElement>

Gibt es irgendwie ein Basisobjekt (mit Enumerator), wo ich beide "zusammen-casten" kann?

Gruß und Danke schon mal für etwaige Antworten

OK, hat sich erledigt, ich war wirklich auf dem Schlauch gestanden. Da immer eine Liste/Collection null ist, habe ich es so gelöst:

IEnumerable active;

if(elementCollection != null) {

  active = elementCollection;

}

else {

  active = inputElements;

}


foreach(IHTMLElement element in active) { ... 

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.