Reference to namespace in .NET MVC3 Razor view in VB?

How to reference namespace in .NET MVC3 with Razor view engine?

I understand that this can be done in C #:

@using Namespace;

However, in VB this does not work:

@Imports Namespace

(I'm talking about a .vbhtml file)

+3
source share
2 answers

You are using the correct syntax for VB:

@Imports My.Full.Namespace

What I found in a quick game is:

  • The subspaces of the MVC project will be compiled intellisense after adding the operator @Imports- should be a full namespace.
  • If you reference a namespace outside the current MVC project, intellisense will not pick it up if you do not perform the restore.
+3
source

@Jonathan , .

, :

@Imports System.Web.Mvc.HtmlHelper

, intellisense . , System.Web.WebPages, HtmlHelper. , , .

, intellisense Import , .

, , - , - .

0

Source: https://habr.com/ru/post/1787608/


All Articles