SFML community forums

Bindings - other languages => DotNet => Topic started by: TechRogue on July 03, 2013, 03:44:49 pm

Title: Sound recycling on .NET
Post by: TechRogue on July 03, 2013, 03:44:49 pm
When I use SFML with C++, I delete sound objects after they finish so as to not hit the limit of 256 sounds. How might I go about this in .NET? Is there a better way that I should be managing this?
Title: Re: Sound recycling on .NET
Post by: Laurent on July 03, 2013, 04:06:47 pm
You can do the same. Why would it have to be different?
Title: Re: Sound recycling on .NET
Post by: TechRogue on July 03, 2013, 04:07:36 pm
I can't manually delete objects in C#, can I? To be honest I'm only using it because it's what my team agreed on; I don't have a lot of experience with it myself.
Title: Re: Sound recycling on .NET
Post by: Laurent on July 03, 2013, 05:06:48 pm
Explicitly destroying an object:

sound.Dispose();

Limiting an object's scope:

using (sound = new Sound())
{

} // implicitly calls sound.Dispose()
Title: Re: Sound recycling on .NET
Post by: TechRogue on July 03, 2013, 05:21:32 pm
Thanks, I didn't know about the Dispose method.
Title: Re: Sound recycling on .NET
Post by: Laurent on July 03, 2013, 06:11:59 pm
It's inherited from the IDisposable interface, which is standard in .Net (not specific to SFML).