SFML community forums
Bindings - other languages => DotNet => Topic started by: Falke88 on November 08, 2014, 09:44:55 pm
-
As I try to create a Generic Class with all Resource in SFML.NET I kinda need to know where property filename resides?
When I call the constructor of the class Texture i.e. I gonna have to pass a "string" filename.
public Texture
(string filename
) : this(filename,
new IntRect
(0,
0,
0,
0)) { }
Is the Constructor Definition within' Texture.cs
since it's called "this" and not "base" it has to be within the Texture class or can "this" be handled like "base" here and filename therefore lies within "ObjectBase" ?
Wherever it lies I can't find the property within Texture.cs and ObjectBase.cs anyway...that's why I'm asking actually.
-
I'm not sure what you ask exactly, but:
1. The constructor that you show just calls another one of the same class, which is defined right below.
2. The class does not expose a Filename property.
-
Ah ok...is this filename property some kind of anonymous property or temporary which never is been saved really?
-
It is not a property.
property != field/member variable
-
well since I can't find it I don't know if its a field or a property sadly :P
-
It's neither :P
The value is passed to another constructor, and then to a C function.
But why don't you simply have a look at the code (https://github.com/SFML/SFML.Net/blob/master/src/Graphics/Texture.cs)? And please read the posts carefully, Laurent mentioned:
1. The constructor that you show just calls another one of the same class, which is defined right below.
In any case, these are implementation details that you -- as a SFML.NET user -- need not be interested in. All you have to know is that you cannot access the filename through which a texture was loaded.
-
Well I had to know these kinda to get an idea how to solve a problem within a generic class where I wanted to create an instance of an generic type class WITH parameters... only with constraint new() it was possible to call the default constructor.
But I solved it using Activator.CreateInstance(x,y) glady :D
thanks for the help anyway guys !