Exemple #1
0
        private static void PrintPerson(PersonStyle style)
        {
            switch (style)
            {
            case PersonStyle.tall:
                Console.WriteLine("大高个子~");
                break;

            case PersonStyle.rich:
                Console.WriteLine("土豪~");
                break;

            case PersonStyle.handsome:
                Console.WriteLine("大帅比~");
                break;

            case PersonStyle.white:
                Console.WriteLine("洁白~");
                break;

            case PersonStyle.beauty:
                Console.WriteLine("美丽动人~");
                break;

            default:
                break;
            }
        }
        public DefaultStyles(Structurizr.Styles styles, Action <ElementType, string> onCreatedFromExistingElement)
        {
            _elementStyle = styles.Elements.FirstOrDefault(x => x.Tag == "Element");
            if (_elementStyle == null)
            {
                _elementStyle = new ElementStyle("Element");
                styles.Elements.Add(_elementStyle);
            }

            Person          = new PersonStyle(styles, onCreatedFromExistingElement);
            SoftwareSystem  = new SoftwareSystemStyle(styles, onCreatedFromExistingElement);
            Container       = new ContainerStyle(styles, onCreatedFromExistingElement);
            Component       = new ComponentStyle(styles, onCreatedFromExistingElement);
            AsyncLineStyle  = new AsynchronousLineStyle(styles, onCreatedFromExistingElement);
            SyncLineStyle   = new SynchronousLineStyle(styles, onCreatedFromExistingElement);
            DependencyStyle = new DependencyStyle(styles, onCreatedFromExistingElement);
        }
Exemple #3
0
        //枚举
        static void Main_Enum(string[] args)
        {
            PrintPersonStyle(PersonStyle.tall | PersonStyle.rich | PersonStyle.handsome);
            Console.WriteLine();
            PrintPersonStyle(PersonStyle.whlie | PersonStyle.rich | PersonStyle.beauty);

            //数据类型转换
            //int ==> Enum
            PersonStyle style01 = (PersonStyle)1;
            //Enum ==> int
            int style02 = (int)(PersonStyle.tall | PersonStyle.beauty);
            //string ==> Enum
            PersonStyle style03 = (PersonStyle)Enum.Parse(typeof(PersonStyle), "beauty");
            //Enum == string
            string style04 = Enum.Parse(typeof(PersonStyle), "beauty").ToString();

            //PrintPersonStyle(style);
        }
Exemple #4
0
 private static void PrintPersonStyle(PersonStyle style)
 {
     if ((style & PersonStyle.tall) == PersonStyle.tall)
     {
         Console.Write("高 ");
     }
     if ((style & PersonStyle.whlie) == PersonStyle.whlie)
     {
         Console.Write("白 ");
     }
     if ((style & PersonStyle.rich) != 0)
     {
         Console.Write("富 ");
     }
     if ((style & PersonStyle.handsome) != 0)
     {
         Console.Write("帅 ");
     }
     if ((style & PersonStyle.whlie) == PersonStyle.whlie)
     {
         Console.Write("美 ");
     }
 }
Exemple #5
0
 void GetPersonType(PersonStyle style)
 {
     if ((style & PersonStyle.High) == PersonStyle.Builty)
     {
     }
 }