Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
AnswerRe: How can Java runs under Java Virtual Machine in linux faster than C# in windows? Pin
Pete O'Hanlon26-Jun-13 22:55
mvePete O'Hanlon26-Jun-13 22:55 
JokeRe: How can Java runs under Java Virtual Machine in linux faster than C# in windows? Pin
cptKoala27-Jun-13 22:30
cptKoala27-Jun-13 22:30 
GeneralRe: How can Java runs under Java Virtual Machine in linux faster than C# in windows? Pin
Pete O'Hanlon27-Jun-13 22:39
mvePete O'Hanlon27-Jun-13 22:39 
AnswerRe: How can Java runs under Java Virtual Machine in linux faster than C# in windows? Pin
Keith Barrow27-Jun-13 0:02
professionalKeith Barrow27-Jun-13 0:02 
AnswerRe: How can Java runs under Java Virtual Machine in linux faster than C# in windows? Pin
jschell27-Jun-13 9:18
jschell27-Jun-13 9:18 
Questionhow to call a method in web service without adding service reference to the code Pin
hosseinDolat26-Jun-13 16:16
hosseinDolat26-Jun-13 16:16 
AnswerRe: how to call a method in web service without adding service reference to the code Pin
Ron Beyer26-Jun-13 16:24
professionalRon Beyer26-Jun-13 16:24 
QuestionGenerating properties of a class dynamically Pin
0bx26-Jun-13 12:19
0bx26-Jun-13 12:19 
Over the project I created several classes and enum's; I hope it's bit self-explanatory:

C#
public enum weaponType{unarmed, dagger, sword, club, axe};
public enum monsterType{ rat, bat, humanoid, feline, beast };

class weapon : item
{
   private weaponType type;
   public weaponType Type
   {
      get { return type; }
      set { type = value; }
   }

   private int requiredSkill;
   public int RequiredSkill
   {
      get { return requiredSkill; }
      set { requiredSkill = value; }
   }
   ...
}

class actor
{
    private name;
    public Name{ get{return name; } set { name = value;} }
    ...

    private int daggerSkill;
    public int DaggerSkill { get{return name; } set { name = value;} }
    private int swordSkill;
    ...
}

class monster : actor
{
   private monsterType;
   ...
}

class player : actor
{
   private ratKills...
}


"Actors" need to have all the "weaponType-Skills" additionally, the player needs to have all the "monsterType-Kills" as separate properties.

However, I would like to freely add and remove items from those enum's without much overhead; because the overhead would increase exponentially if the project becomes more complex.

So what I rather like to do is the compiler to iterate through the enum and generate all the extra properties like "Skill" and "Kills" dynamically and to be able to use them as if they're fully written out.

So far I haven't been able to figure out how, or if, this can be done programmatically; without resorting to make some code generator.

As usual, any help is much appreciated.
.

AnswerRe: Generating properties of a class dynamically Pin
Ron Beyer26-Jun-13 14:37
professionalRon Beyer26-Jun-13 14:37 
GeneralRe: Generating properties of a class dynamically Pin
0bx26-Jun-13 16:11
0bx26-Jun-13 16:11 
GeneralRe: Generating properties of a class dynamically Pin
Ron Beyer26-Jun-13 16:18
professionalRon Beyer26-Jun-13 16:18 
GeneralRe: Generating properties of a class dynamically Pin
Freak3027-Jun-13 2:47
Freak3027-Jun-13 2:47 
GeneralRe: Generating properties of a class dynamically Pin
0bx28-Jun-13 3:01
0bx28-Jun-13 3:01 
QuestionC# select excel file from directory path Pin
classy_dog26-Jun-13 10:56
classy_dog26-Jun-13 10:56 
AnswerRe: C# select excel file from directory path Pin
Ron Beyer26-Jun-13 15:26
professionalRon Beyer26-Jun-13 15:26 
Question2 way events Pin
bfis10813726-Jun-13 8:56
bfis10813726-Jun-13 8:56 
AnswerRe: 2 way events Pin
Ron Beyer26-Jun-13 9:12
professionalRon Beyer26-Jun-13 9:12 
GeneralRe: 2 way events Pin
bfis10813726-Jun-13 10:34
bfis10813726-Jun-13 10:34 
AnswerRe: 2 way events Pin
Dave Kreskowiak26-Jun-13 12:10
mveDave Kreskowiak26-Jun-13 12:10 
GeneralRe: 2 way events Pin
bfis10813726-Jun-13 16:43
bfis10813726-Jun-13 16:43 
QuestionC# obtain db values from app.config of program accessed by a dll Pin
classy_dog26-Jun-13 7:11
classy_dog26-Jun-13 7:11 
AnswerRe: C# obtain db values from app.config of program accessed by a dll Pin
NickPace26-Jun-13 12:07
NickPace26-Jun-13 12:07 
QuestionPassing boolean parameter to an oracle procedure Pin
Subin Mavunkal26-Jun-13 3:39
Subin Mavunkal26-Jun-13 3:39 
AnswerRe: Passing boolean parameter to an oracle procedure Pin
NotPolitcallyCorrect26-Jun-13 3:56
NotPolitcallyCorrect26-Jun-13 3:56 
GeneralRe: Passing boolean parameter to an oracle procedure Pin
Subin Mavunkal26-Jun-13 4:03
Subin Mavunkal26-Jun-13 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.