2016-08-30 1 views
-4

using System;도트 연산자를 사용하여 클래스에 배열을 사용할 수있는 방법

문자열 [] talentSlots = new string [2];를 사용하고 있습니다. 저는 agent.talentSlots = blah blah를 어떻게할까요? 어떻게해야합니까?

namespace warhammerRPGCB 
{ 
    public class classes 
    { 
     string className; 
     int stanceRed; 
     int standGreen; 
     string carrerSkills; 
     string primaryChar; 
     string[] talentSlots = new string[2]; 
     int focusSlot; 
     int reputationSlot; 
     int tacticSlot; 

     public classes() 
     { 
      classes agent = new classes(); 
      agent.className = "Agent"; 
      agent.carrerSkills = "Charm, Education, Folklore, Guile, Intution"; 
      agent.stanceRed = 2; 
      agent.standGreen = 2; 
      agent.primaryChar = "Intelligence, Felloship"; 
      agent.tacticSlot = focusTalent, reputationTalent; 
     } 
    } 
} 

답변

2

는 어레이 형 추론 될 수있는 배열을 초기화

agent.talentSlots = new string[] {focusTalent,reputationTalent}; 
+2

주를 사용할 수있다 : '= agent.talentSlots 새로운 [{focusTalent, reputationTalent}' –

관련 문제