Allow ref struct on Generic ThrowHelper methods
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp
- Área
- backend-api-design
Línea de trabajo
No se nombra ningún archivo ni prueba. Empieza por localizar las API genéricas de ThrowHelper y comprobar cómo están declarados sus parámetros de tipo; confirma la compatibilidad del proyecto con .NET 9 y C# 13. Se considera terminado cuando los tipos ref struct, como Span, pueden usarse con los métodos ThrowHelper existentes sin cambiar su comportamiento.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Overview
This would allow ref structs to be used in pattern matching with a ThrowHelper case, using the new allow ref struct "anti-constraint".
API breakdown
This changes nothing except allowable use cases for existing ThrowHelper APIs.
Usage example
I encountered a situation in my code where I wanted to pattern match and return a ref struct. I found I could not use the ThrowHelper because it was a ref struct.
Here's an example of another imaginable situation utilizing the Span<T>.
Span<int> span = x switch
{
0 => stackalloc int[size],
1 => new int[size],
2 => something.AsSpan(),
_ => ThrowHelper.ThrowArgumentOutOfRangeException<Span<int>>(),
};
Breaking change?
No
Alternatives
throw without ThrowHelper
Additional context
This will require .NET 9 and C# version 13
Help us help you
Yes, I'd like to be assigned to work on this item
- Lenguaje dominante
- C#
- Estrellas
- 3.8k
- Forks
- 401
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CommunityToolkit/dotnet
-
RelayCommand<T>.CanExecute(null) returns false for value types without a predicatePosiblemente ocupada @apachezy la tomó hace 80 días. Abiertobug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
CommunityToolkit/dotnet#1206 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
CommunityToolkit/dotnet#648 ·
-
bug :bug:
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
CommunityToolkit/dotnet#1215 ·
-
Add segmented buffering and sequence reads to `ArrayPoolBufferWriter<T>`Posiblemente ocupada @paulomorgado la tomó hace 17 días. Abiertofeature request :mailbox_with_mail:
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
CommunityToolkit/dotnet#1214 ·
Todos los issues de CommunityToolkit/dotnet
Issues similares
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
-
bug misleading tooling trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Docs example projects pinned to a literal library version instead of 3.*Posiblemente ocupada @DaveSkender la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
facioquo/stock-indicators-dotnet#2372 ·
Los mantenedores suelen responder en 1 día
-
[Docs] officecli-docx SKILL.md still describes `\n` as a soft line break after #262Posiblemente ocupada @giprime la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Facepunch/sbox-public#12097 ·
Los mantenedores suelen responder en 2 días