Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

499
Views
What does the angle bracket syntax mean in C#

I am reading this book, and it tries to use initializer to Create the DB each time the application runs, so the code snippet is like this:

protected void Application_Start() {
    Database.SetInitializer(new DropCreateDatabaseAlways<MusicStoreDB>());

    AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}

I can't understand this part:

 new DropCreateDatabaseAlways<MusicStoreDB>()

What is this syntax? what does <MusicStoreDB>() mean?

I know it's not a fancy question, but I need help here.

Thanks.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

That syntax is called generics. In a nutshell (a very tiny nutshell), imagine that your app had more than 1 database (e.g. MusicStoreDB, MovieStoreDB, etc), you could use the same DropCreateDatabaseAlways class with the different db types. In other words, generics let you define classes and functions that can act on many different types, for example

List<int>, List<string>, List<MyAwesomeClass>

over 4 years ago · Santiago Trujillo Report

0

DropCreateDatabaseAlways is the database intializer base class. MusicStoreDB is the database which will be dropped and re-created everytime the application starts. DropCreateDatabaseAlways<MusicStoreDB>() is the code that does that

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!