S
Snaggy
Hi, this is my first day using c# and I must say it's cool but data
types.. I'm not use to them (php...) they're driving me crazy.
I need to declare a class variable, but I don't know it's type since
it's passed to the constructor when the object is created. I'd like
something like this:
class MyClass
{
public MyClass(int attribute)
{
if (attributes == 1)
{
string myDeck = "something";
}
else if (attributes > 1)
{
int myDeck = "123";
}
}
public string tellMe() // by the way I'm saying string, but
it might be integer... what the..
{
return myDeck;
}
}
how can I solve this mess? Can anyone reassure me that this compulsory
typing isn't actually just a headache?
bye!
Luca(IT)
types.. I'm not use to them (php...) they're driving me crazy.
I need to declare a class variable, but I don't know it's type since
it's passed to the constructor when the object is created. I'd like
something like this:
class MyClass
{
public MyClass(int attribute)
{
if (attributes == 1)
{
string myDeck = "something";
}
else if (attributes > 1)
{
int myDeck = "123";
}
}
public string tellMe() // by the way I'm saying string, but
it might be integer... what the..
{
return myDeck;
}
}
how can I solve this mess? Can anyone reassure me that this compulsory
typing isn't actually just a headache?
bye!
Luca(IT)