Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:03:59+00:00 2026-06-09T08:03:59+00:00

Reading Code Generation and T4 Text Templates and I found this syntax <#= DateTime.Now

  • 0

Reading Code Generation and T4 Text Templates and I found this syntax <#= DateTime.Now #>

<html><body>
 The date and time now is: <#= DateTime.Now #>
</body></html>

How is it different from <%= DateTime.Now %> or <%# DateTime.Now %>.

Google search showed nothing

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:04:01+00:00Added an answer on June 9, 2026 at 8:04 am

    I can’t claim to be really familiar with T4 text templates, but it appears the difference is between design/build time code generation (which can include executable statements) and runtime code execution.

    So <#= #> evaluates an expression within a template that is used to generate a file.

    And <%= %> executes the code within the block and writes it to the output stream. This will be JIT-compiled when the page is first executed, but the point is that it denotes a block of code to execute when the page runs, not during generation of a templated file.

    The third form, <%# %> denotes a databinding expression, also evaluated when the page executes.

    Expression control blocks

    An expression control block evaluates an expression and converts it to
    a string. This is inserted into the output file.

    Expression control blocks are delimted by the symbols <#= … #>

    For example, the following control block causes the output file to
    contain “5”:

    <#= 2 + 3 #>

    Source: http://msdn.microsoft.com/en-us/library/bb126478

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading code from GraphServer . And there is this function that has weird
I was reading Code Conventions for Java from http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-137265.html#587 . In that, they have
I have a simple text reading code for Visual Basic: Dim fileReader As String
Reading existing code at work, I wondered how come this could work. I have
I'm reading this code sample : And since I don't know C#, I decided
I have this code to read in a text file, with words separated by
I am reading Code Complete. In that book, Steve McConnell warns that Developer tests
Context Sometimes, I like reading code on paper rather than on screen (so I
I`m reading the code of some open source project. I see that in one
While reading a code I came across, the following definition and initialization of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.