Category Archives: C#

C# – First steps with C# and .NET – part 002 .

Today I will show you more about C# and the subject of this tutorial is: threads.
First you need to start a project into your folder. Let’s see my example:

You can use notepad or any editor to edit the Program.cs:

About the thread issue then you need to know is a very complex subject.
My example will show you how the thread works.
First you need to start the thread and then deal with the thread.
Two methods is used: Start and Join.
Start begins executing at the first line of the method and does not block the calling thread.
Join is a synchronization method that blocks the calling thread (that is, the thread that calls the method) until the thread whose Join method is called has completed.
I used three threads and this threads just start count first 5 sec , next 8 sec and the last is set to 10 sec.
Let’s see the example:

Each thread will write to the output and then will see the time used.
See the output of dotnet run command:

Posted in All, C#, Commands, Programming, Windows 10. Tagged with , , , , , , , .

C# – First steps with C# and .NET – part 001 .

First you need to take a look at Microsoft DotNET – Core website..
This website will be the start for any .NET and C# issue on any operating system Linux, Windows, Mac or Docker.
I used for this tutorial Windows OS and for Fedora distro you can take a look here.
First you need to

The result of Hello World! show us the console application works well.
This will run this program:

You can change the text Hello World or test something else.
If you got errors the you need to fix it with :

Posted in All, C#, Commands, Programming, Windows 10. Tagged with , , , , , , , .

The ILSpy – CSharp tool .

The ILSpy is the open-source .NET assembly browser and decompiler can be found here.
Let’s see the basic features of this tool:

  • Assembly browsing
  • IL Disassembly
  • Support C# 5.0 “async”
  • Decompilation to C#
  • Supports lambdas and ‘yield return’
  • Shows XML documentation
  • Decompilation to VB
  • Saving of resources
  • Save decompiled assembly as .csproj
  • Search for types/methods/properties (substring)
  • Hyperlink-based type/method/property navigation
  • Base/Derived types navigation
  • Navigation history
  • BAML to XAML decompiler
  • Save Assembly as C# Project
  • Find usage of field/method
  • Extensible via plugins (MEF)
  • Assembly Lists

I test it with a simple example of my source code and work’s great.
About ILSpy decompiler – the integrated debugger can be download it from here.
For example: you can see classes in my application ( see it works with SQLite), resources and more…

Posted in All, C#, Programming, Windows 10. Tagged with , , , , , .

Using C # and Visual Studio 2015 to make additional form.

Today I will told you about how to use additional form into C# source code without using Form Design.
First you need to open under Visual Studio 2015 a new project Windows Form Application.
This project will come with a windows form.
Press Ctr+Alt+X keys and will see the Toolbox with all Windows controls.
Add one button to your window form with double left click.
Use double left click to your button and will see the source code of your form.
The C# script will be Form1.cs and for your button will have this:

If you want to open a new form with your button then you need to add source code:

This source code will make a new form named fInfo with this text: Info and about !.
Into this form will have a label named myText with this text: This software is created by the website: free-tutorials.org!.
The form fInfo add the label myText and finally show this form.
The source code come with size, height , weight and location to show the form and label to design form.
The StartPosition is used to put the form into center of your screen.

Posted in All, C#, Programming, Visual Studio, Windows 10. Tagged with , , , , , , .

Using C# with twilio to send SMS – part 001.

You need to have a account at twilio.com.
I used a free trial account to make this demo application.
You need to take for you a number on that support Twilio SMS. I got one in the US to send SMS to my country.
Open your Visual Studio and create a new Project with Windows Form Application.
This will make your Windows Form with Form1.cs and Form1.cs [Design] .
You need to install with Visual Studio the twilio-csharp library.
This library lets you write C# code – go to Visual Studio menu:
Tools > NuGet Package Manager > Package Manager Console and use this command to install twilio-csharp library.

Find the Toolbox ( Ctrl+Alt+X keys ) and add one button to your Windows Form.
Under Form1.cs [Design] press double left click with the mouse on Button ( is named button1 ).
This will open the Form1.cs and add this source code:

Fill with your accountSid, authToken and your number mobile phone from your twilio account console.
Save the file Form1.cs and then Build and Run the application.
Press the button to send the SMS message and you will see this output:

Posted in All, C#, Programming, Visual Studio, Windows 10. Tagged with , , , , .