What is the difference between Class and Code File on Asp.net Core?

Asked

Viewed 67 times

8

What is the difference between Class and Code File in Asp.net Core?

inserir a descrição da imagem aqui

There are two types of files in Asp.net core, there is some difference between one and the other?

And when we should use each?

  • It’s not just Asp.net core, codefile.Cs is created with build action Content, instead of Compile common-class.

1 answer

3


The "Class" option generates a C# code file with a basic class structure, like this:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp1
{
    class Class1
    {
    }
}

Already the option "Code File" generates an empty source file, where you have to write everything from scratch. In practice the only difference is template used in the first.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.