Skip to content

antikorol/incorrect-list-usage-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Result of running this sample

public class SimplifiedKubeLogic // This is the simplified logic of the class  Kube where I removed everything unnecessary and kept only the modification of the list from different threads.
{
    private readonly List<SampleService> _services;

    private volatile int _index = 0;

    public SimplifiedKubeLogic()
    {
        _services = new List<SampleService>();
    }

    public virtual async Task<List<SampleService>> GetAsync()
    {
        await Task.Yield();

        _services.Clear();

        _services.AddRange(new[] { new SampleService { Host = Interlocked.Increment(ref _index) } });

        return _services;
    }
}
image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages