Home > Net >  Consult everybody enumeration problem
Consult everybody enumeration problem

Time:03-23


I have an enumerated in the class A vector, which is defined two direction, now I want to call A method in class B set in A vector, and introduced to an enumeration parameter what should I do?
Public calss A

{

Public enum GetVector {up and down}

Public void SetVector (enumeration) {


}

}

Public calss B

{


Public void the click () {
A. A=new A ();
A.s etvector (how do I write here);
}

}

CodePudding user response:

Why don't you move the enumeration come out?
Add A corresponding to A class of enumerated attribute
 public vector vector {get; set; } 

After A class instantiation, direct
 Dr. Ector=vector. The up 

CodePudding user response:

I was encapsulates an enumeration method,
https://blog.csdn.net/hanjun0612/article/details/70807664

CodePudding user response:

Enumerated on the outside of the Class definition, in the Class can be referenced can be directly,
  •  Tags:  
  • C#
  • Related