SFML community forums

Bindings - other languages => DotNet => Topic started by: Xeon06 on December 29, 2009, 11:48:04 pm

Title: Override ToString
Post by: Xeon06 on December 29, 2009, 11:48:04 pm
Hey,

I don't know where to post this, but it would be nice if in the next version the ToString functions were overridden in the structs for SFML.Net. The bugtracker seems exclusive to the C++ version so I posted here.
Title: Override ToString
Post by: Laurent on December 30, 2009, 01:10:01 am
I don't use the bug tracker anyway, so you did well ;)

Actually I didn't think about the ToString functions, thanks for reminding me. I'll try to implement them soon.
Title: Override ToString
Post by: Xeon06 on December 30, 2009, 11:09:18 pm
No problem, they're just really useful when debugging, say I want to know what an object's position is, I can just do Console.WriteLine(pos.ToString()); instead of (pos.X.ToString() + " " + pos.Y.ToString());.

Thanks.
Title: Override ToString
Post by: Laurent on January 06, 2010, 01:39:55 pm
It's implemented, it will be available in SFML 2.

I don't know if there is a "standard" way or format for implementing the ToString function, so here is what I used for every class:
Code: [Select]
"[ClassName] attribute1 = value1 attribute2 = value2 attribute3 = value3 ..."
Title: Override ToString
Post by: Xeon06 on January 17, 2010, 01:53:43 am
That's good, only thing I would change is maybe add a coma between attributes, but it's all up to you ;)
Title: Override ToString
Post by: Laurent on January 17, 2010, 10:37:05 am
You're right, I'll even change it to:
Code: [Select]
"[ClassName] attribute1(value1) attribute2(value2) attribute3(value3) ..."
This will be less confusing when there are nested objects :)
Title: Override ToString
Post by: Xeon06 on January 19, 2010, 01:51:51 am
Awesome, thanks! Is there any way to get 2.0 for DotNet? I checked on the SVN but the DotNet directory looks like 1.5 to me.
Title: Override ToString
Post by: Laurent on January 19, 2010, 11:27:09 am
SFML.Net is always up-to-date in SFML 2, you can use it.

Quote
I checked on the SVN but the DotNet directory looks like 1.5 to me

What do you mean (SFML 2 is in branches/sfml2, not in trunk)?
Title: Override ToString
Post by: Xeon06 on January 19, 2010, 07:10:16 pm
My bad! I got it now. Thanks.