Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CloudEventAttribute should implement equality operators

Aperta
#229 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
api

Direzione di ricerca

Inizia individuando CloudEventAttribute, CloudEvent.GetPopulatedAttributes() e il metodo esistente che recupera un attributo. Esamina i test nelle vicinanze e la documentazione sugli attributi di estensione, quindi definisci il comportamento previsto per la ricerca o l’uguaglianza in base all’issue. Il lavoro è completato quando i chiamanti possono identificare in modo affidabile un attributo facoltativo senza dover gestire scomodamente i KVP e sono presenti test per i nomi mancanti e ripetuti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CloudEvent.GetPopulatedAttributes() returns an IEnumerable<KeyValuePair<CloudEventAttribute, object>> which is actually a bit odd. You'd think it would be usable as a dictionary, but I'm guessing there might be a cause where the same attribute names appear more than once, but in my case, I know they won't, so I tried to create a dictionary from it, but unfortunately, since the Key is CloudEventAttribute, indexing it requires equality operators. Even if I simply search the list of KVPs, it makes it awkward to find an attribute that may or may not exist (SingleOrDefault for example, because default is a KVP with null values), so I think I have to loop on it the old fashioned way.

I find the interface in general to be very awkward, but I think some comparison operators would be helpful, or even a helper method that can grab the attribute and/or value by name. There's already a method to get the attribute, there's just no value in it; it's only the name. Maybe there's some other incantation I'm not seeing; the documentation on extension attributes is lacking in general.

Lingua principale
C#
Stelle
334
Fork
88
Merge medio
6m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudevents/sdk-csharp

Tutte le issue di cloudevents/sdk-csharp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.