Microtron Ltd - IT Solutions - NZ

Visual Studio C# Language

There has been some loss of the ability to protect constants. In particular, multidimensional arrays are problematic.

Here is a simpler case.

   private void method1()
   {
        const bool b = ListView1.CanSelect;
        // Error	CS0133	The expression being assigned to 'i' must be constant

        readonly bool b = ListView1.CanSelect;
        // Error	CS0106	The modifier 'readonly' is not valid for this item

        b = false;                   // desired compiler error here
   }

It would also be good to have object scope variables that are only visible in one or maybe two methods. Possible code for this is as follows.

   private void method1()
   {
       instance int found = 0;
       found++;      
       Console.WriteLine(found);
   }
   private void method2()
   {
       instance int found;
       found--;       
       Console.WriteLine(found);
   } 
   private void method3()  
   { 
       found = 0; // compiler error 
} static void Main(string[] args) {    method1();       // output:  1        method1();       // output:  2        method2();       // output:  1 }

Another idea would be to have a way to break out of an if statement. 

   if(colour == Color.Blue)
   {
       if(shape == Shape.Round)
       {
           // Do stuff
       }

       if(result.valid != true)
            break 1;   // The number would be the index of the if-statement-layer 
                            // to break out of counting from the inside out.

       if(shape == Shape.Square)
       {
           // Do stuff
       }
   }

In the above example, break 0; would break out of  if(result.valid != true), which would be not what was required in this case. Break 1; would break out of if(colour == Color.Blue) and is what was intended.

This could result in nicer code where if stucture could be otherwise undersirably complex.  However, using this device to much would not be desirable either.  Good programmers would likely appreciate another tool to help build well structured programs.

 

C# in VS rejects readonly variable when a varaible initialiser is used. The error message says that this should work and it would be logical to do so. 

    public class EventArgs
    {
        public readonly Item item;
        public int itemindex;        
        public Subitem subItem;
        public int subItemIndex;
    }


    EventArgs tea = new EventArgs()
    {
                    item = Items[focussedSubitem_row],
                    itemindex = focussedSubitem_row,                    
                    subItem = Items[focussedSubitem_row].SubItems[focussedSubitem_column],
                    subItemIndex = Colord[focussedSubitem_column],                    
     };
     // Error CS0191 A readonly field cannot be assigned to 
     // (except in a constructor or a variable initializer)

 

Selecting 256 characters as a new base table to improve on ASCII if possible. Need more changes yet. I need this for applications that require every value to have a distinct character e.g. software installation codes and microcomputers. An example is visualisation of Hexidecimal.

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZБГгДдЁёЖжЗзИиЙйЛлПпФфЦцЧчШшЩщЪъЭэЮюЯяαβγδεζηθιλμνξοπρστᾠφχψΓΔΘΛΞΣΦΧΨΩʆʇʉʊʋʌʍʎʏʐʑʓʕʖʘʚʛʝʞʠʡʢʣʤʥʦʧʨʩʪʫʬʭȣȤȥȦȧȨȩȪȬȲȳȴȵȶȷȸȺȻȼȽȾȿɀɃɄɅɆɇɈɉᵫᵬᵭᵮᵰᵱᵲᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚ!@#$%^&*-+=_(){}|\/ „,?<>~‡†”“‘’;:" 


Also notice that HTML 'pre' does mot word wrap very sensibly.

 

 

 

 

 

 

 

 

 

 

Websites, Facebook advertising, Arduino robots, Raspberry Pi and phone applications, Music notation and MIDI, Tutoring, Automatic back-up, Networking, Simple web invoicing using secure HTML, Standard Gcode Programs for lathes, Automated G-code, Linux, Windows and Mac administration, Auto-mated Documentation including Jobsheets and invoicing, Database applications, Everyday computer and device problems.