Event Logging Area in C #

Maybe the event handler "completed" will not be called due to the release of GC resources?

public void StartVideo(WerCamera camera) { Credential creadential = new Credential() { Email = CurrentUser.Email, Password = CurrentUser.Password, SessionNumber = SessionNumber}; CommandsClient client = new CommandsClient(); client.StartVideoCompleted += client_StartVideoCompleted; client.StartVideoAsync(int.Parse(camera.Id), creadential, ClientInfo); client.CloseAsync(); } 
+4
source share
1 answer

Yes, it is possible, since you lose all references to the client after the function returns.

client.StartVideoCompleted += client_StartVideoCompleted; it ends up containing a reference to the object using the client_StartVideoCompleted function, but this does not reciprocate. You will need to somehow save the link to the created client.

+2
source

Source: https://habr.com/ru/post/1386101/


All Articles