Blazor.NET a new way to think web application

Recently, in March 2018 Microsoft launched the Alpha version of a new way of thinking to develop the web application which BLAZOR.NET.

Nowadays if you see yourself as a web application developer then you are heavily surrounded with JavaScript, for example, Angular JS, VU.JS etc.

In the nutshell, if you want to survive in the Web development field you have to have learned any of the above-mentioned JavaScript frameworks moreover need to learn JavaScript as well, which is good although.

But now Microsoft brings a new framework which Blazor.NET which I can say is the new way of thinking of web application development and without less dependency on JavaScript.

So, If you want to create any Single Page Application for which you to heavily dependent on the JavaScript framework like AngularJS earlier which you can avoid and create the sample kind of SPA application using Blazor.NET with your favorite C# language. Isn’t it a big surprise?

This New Blazor.NET framework helps .NET (C#) developers to create the web application with the help of web assembly without depending on Javascript.

We can use the same Razor syntax and C# language to create a web application.

Although it is an experimental project, surely it will be used with full swing soon.

We can start Blazor.NET project by the following step

We can start Blazor.NET project by following step

1) Install the latest preview of Visual studio 2017 (15.7)

2) Install .NET Core 2.1 preview

3) Install Blazor.NET extension

Let’s install all the above 3 required component and in the next blog, I will show step by step tutorial to create a blazor.NET.

The Dummies’ Guide to How to solve Problems with Extension Method

I am pretty much sure that, You have used Extension method in your program. Did you think to create your custom Extension method ?

If not then this article help you to create your own Extension method step by step.

Before jumping to direct practice let’s understand first what is extension method. So, an Extension method is created to simplify the code. It is a static method which represent as instance method. It accepts “this” keyword as a parameter.

If you see below example image you are not going to surprise as you have used this type of method.


Now, let me tell you more about the Extension method. As you now aware it is a static method & it accept “this” as a parameter so just need to add a “.” dot symbol with variable and all the existing method will be appear.

The question come to our mind how to create our own Extension method. So, it is simple and easy. We need to create a static class first and then that static class we can create our own Extension method.


Once you added a class in your solution specify the class as a static class and a static method in the class. In below example I am using static method with name  “MyStringCharacterLength”  if you see the below snap you will find in the parameter we are using this which is must for an extension method. We are not doing any fancy with this method it is a simple logic of calculating the length of the string.


Now once the extension method is created we can use this method using by a “.” dot symbol. Isn’t it easy let me show you the code.


When we run this code it will return the length of the string which provided as a input.

I hope a basic now you have a basic understanding of extension method. You can create your various method to use this and reduce your efforts in cases where you have to write similar logic again and again.

I recommend below site from where you can download existing Extension method and  use it.

I hope you have a clear view of extension method now.


How to do 7zip programmatically using C# ?

Dear All,

Some times it may be possible you require to  make zip of  a file or directory.

so here is simple example.

To start it you have to download “SevenZipSharp.dll”, “7z.dll” you can download sdk from

Once you download sdk copy above 2 DLL in your project bin folder.

Now write below code which i am writing here


   2: public bool CompressFolder(String 

   3: backupFolder)


   5: {


   7: try


   9: {


  11: SevenZipCompressor sz = new SevenZipCompressor(); 


  13: SevenZip.SevenZipCompressor.SetLibraryPath(DLLPath);


  15: sz.CompressionLevel = 

  16: CompressionLevel.Ultra;


  18: sz.CompressionMode = 

  19: CompressionMode.Create;


  21: sz.CompressionMethod = 

  22: CompressionMethod.Default;


  24: sz.FastCompression = 

  25: true;


  27: sz.CompressDirectory(backupFolder, BackupPath + "\\" + 

  28: DateTime.Now.Date.ToString("yyyyMMddHHmmss") + 

  29: "_7Zip.7z");


  31: Directory.Delete(backupFolder,true);


  33: return true;


  35: }

  36:  catch (Exception 

  37: ex)


  39: {


  41: throw ex;

  42:  }

Now let me describe the code to you.

This is function which compress the folder to 7zip what ever pass as a paramter

in this function we have created a sevenzip compressor object


in the above line we set the DLLpath which is basically your bin folder path

sz.CompressionLevel = CompressionLevel.Ultra; is compress level which can be different according to your need.

sz.CompressDirectory(backupFolder, BackupPath + "\\" + DateTime.Now.Date.ToString("yyyyMMddHHmmss") + "_7Zip.7z");

above row compress the directory of backupfolder and rename with datetime_7zip.7z

I hope this will help you.

Enjoy 7zip.

Thanks & Best Regards,

Rajat Jaiswla

LINQ with CheckBox List–LINQ Tips

Dear All,

There are many situation where you need to comma separated values of all the checked items of a checkbox list for this situation you generally write following  code

string allowedProductfamilies = string.Empty;
foreach (ListItem lItem in chkFamily.Items)
                    if (lItem.Selected)
                        allowedProductfamilies += lItem.Value + ",";

Now the above code is fine but can be improve more with following lines of code you can directly replace above lines with following lines of the code

string allowedProductfamilies = string.Empty;

allowedProductfamilies = chkFamily.Items.Cast<ListItem>().Where(lItem => lItem.Selected).Aggregate(allowedProductfamilies, (current, lItem) => current + (lItem.Value + ","));


I am sure you like the code.

Enjoy .Net , Enjoy LINQ .

Your Friend,

Rajat Jaiswal

How to incorporate word press theme in my Razor Blog

Hello friends,
As you know currently I am working on Razor. So I am trying to make a WordPress blog with Razor.Net.
Now the challenging task for me is design. I am not so good in designing so it’s a big deal for me. I just thought to download the WordPress theme and incorporate in My Blog work. So thanks to  free word press theme I just downloaded the technology themes from there you can visit and see the other design.I like Mac Doc wordpress theme so here is the steps which I followed which help you also.
1) Just downloaded  the theme from any free wordpress theme sites
2) Copy all the images in your image folder of site
3) Copy CSS file in your Style folder.
4) Now open your site Layout page
5) Replace the body part of your site layout with default preview page of word press theme which you are looking currently. In my Case (free Mac theme page)
6) Then try make pieces of your design like  in my case on the default page there is a header part, footer part,  Search Box part, Archive Part, Center part (Where we will see post),Tag part, Category part.
7) So what I did I created all this part as a separate page like header.cshtml, footer.cshtml, SearchBox.cshtml, Archive.cshtml, Deafult.cshtml, TagSearch.cshtml, CategorySearch.cshtml.
8) Just cut the part from your site layout for specific items like header, site bar, content, category etc.
9) In SiteLayout page only call this pages. This is the simplest way.
10) Now if I need to incorporate any other Word press theme then I just needs to copy the theme and just need to replay site layout. This is the simplest way I found with Razor.

11) The best part is I just need to create a page cshtml and can place anywhere according to need and it will work like a word press functionality.

I hope you got some idea.
Soon I am going to upload the Blog which will help you to understand the concept of Razor more. It’s a simplest blog creation.
Rajat Jaiswal