dotnet / dotnet/dotnet-api-docs
GC.ReRegisterForFinalize(Object) Method – object arg/param is not limited to caller
- Lenguaje dominante
- C#
- Estrellas
- 949
- Forks
- 1.7k
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 52
Descripción
From [Remarks](https://docs.microsoft.com/en-us/dotnet/api/system.gc.reregisterforfinalize?view=net-5.0#remarks)
> The ReRegisterForFinalize method adds the obj parameter to the list of objects that request finalization before the garbage collector frees the object. The obj parameter must be the caller of this method.
Verifying example one can gather no error on `GC.ReRegisterForFinalize (new object());` call.
```csharp
class Program
{
static async Task Main ( string[] args )
{
Test test;
foreach(var i in Enumerable.Range(0, 2))
test = new Test ();
test = null;
GC.Collect ();
await Task.Delay (1_000);
}
class Test
{
~Test ()
{
Console.WriteLine ("AAAA");
GC.ReRegisterForFinalize (this);
GC.ReRegisterForFinalize (new object());
}
}
}
```
### Project
[GcReRegisterForFinalize.zip](https://github.com/dotnet/docs/files/7148204/GcReRegisterForFinalize.zip)
Guía de contribución
Línea de trabajo
Comienza con la documentación vinculada de ReRegisterForFinalize Remarks y la reproducción proporcionada en C#, y luego verifica qué significa la restricción del parámetro obj para el comportamiento observado. Se considera terminado cuando la documentación de la API explica con precisión si la restricción del llamador se aplica y cómo debe interpretarse el ejemplo.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100