示例#1
0
        private void junkClassToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string random_namespace  = string.Format("{0}.{1}", GetRandomClassName(), GetRandomClassName());
            string random_class_name = GetRandomClassName();

            SyntheticClass my_generated_class = new SyntheticClass(random_namespace, random_class_name);

            for (int i = 0; i < random.Next(8, 16); i++)
            {
                string random_property_name = GetRandomPropertyName();
                Type   random_type          = GetRandomType();

                SyntheticProperty property = my_generated_class.AddProperty(random_type, random_property_name);
                int r = random.Next(0, 3);
                if (r == 1)
                {
                    property.Modifier = SyntheticModifier.Public | SyntheticModifier.Static;
                }
                else if (r == 2)
                {
                    property.Modifier = SyntheticModifier.Public;
                }
                else
                {
                    property.Modifier = SyntheticModifier.Protected;
                }
            }

            // generate code to string
            string generated_code = my_generated_class.ToString();

            // add code to text
            scintilla1.Text = "";
            scintilla1.AddText(generated_code);
        }
示例#2
0
 public SyntheticProperty(SyntheticClass parentClass, string name, Type type)
 {
     _parentClass = parentClass;
     Name         = name;
     Type         = type;
 }