Assign Mirror

March 10, 2014 at 2:10 AMadmin


Assign Mirror is a small tool that is mirror the assign statement ( replace the left side with the right side and the right side with left side ) 

Usage :  assume you are writing a code in your database application to read the values from your business object and puts the values in a controls on your form ( about 30 field ) and now you want to save the values form the form controls to your object so you can save it in the database again , the fast method will be by copying your previous code and change the  left side of the assign operator with the right side . 

but if you have a tool that make this for you, you are going to save time and type mistakes :) 

The Code :

create as GUI like the bellow screen shoot





Then add the following code to the ( Mirror ) Button



bool mAddSemicolon = false;


foreach (string mStr in txtMirrorSource.Lines)


    if (mStr.Contains("="))


        string mTempStr = "";


        if (mStr.Contains("//"))

mTempStr = mStr.Substring(0, mStr.IndexOf("//")).Trim();

        else if (mStr.Contains(";"))

mTempStr = mStr.Substring(0, mStr.IndexOf(";") + 1);


mTempStr = mStr.Trim();


        mAddSemicolon = mTempStr.EndsWith(";");



        txtMirrorDist.AppendText(" = ");



        if (mAddSemicolon) txtMirrorDist.AppendText(" ;");






Posted in: .NET | IT


Add comment

  Country flag

  • Comment
  • Preview