Questions tagged [inline-code]

Source code that is written into the body of a program, in the same or different language as/than the host language.

188 questions
112
votes
8 answers

Are there inline functions in java?

Is there a concept of inline functions in java, or its replaced something else? If there is, how is it used? I've heard that public, static and final methods are the inline functions. Can we create our own inline function?
giri
  • 24,958
  • 61
  • 134
  • 175
65
votes
3 answers

Is it bad practice to write inline event handlers

Is it bad practice to write inline event handlers ? For me, I prefer use it when I want to use a local variable in the event handler like the following: I prefer this: // This is just a sample private void Foo() { Timer timer = new Timer() {…
Homam
  • 21,556
  • 28
  • 104
  • 181
38
votes
8 answers

onclick="" vs event handler

If I want a function to be executed, I prefer doing inline js:

Click me

because it is easier to debug. However, I hear people saying not to use inline js, and…
Johan
  • 1,467
  • 1
  • 11
  • 17
38
votes
2 answers

Inline Code in DokuWiki

I'm looking for a way to include code as part of a paragraph in DokuWiki like I can by adding backtick escapes in StackOverflow like _so_. Simply adding bla puts code on it's own line.
Alan Turing
  • 11,403
  • 14
  • 66
  • 114
21
votes
5 answers

Why there is no standard way to force inline in C++?

According to the wikipedia C++ article C++ is designed to give the programmer choice, even if this makes it possible for the programmer to choose incorrectly. If it is designed this way why there is no standard way to force the compiler to inline…
Calmarius
  • 16,155
  • 15
  • 95
  • 134
17
votes
3 answers

Can I use Extension Methods inline in an ASPX page?

Is it possible to do something like this inline in an ASPX page? <%= Me.SomeExtensionMethod() %> I can't seem to figure out how to get this to work properly. I'm receiving an error saying that "SomeExtensionMethod" is not a member of the current…
Mark Carpenter
  • 16,446
  • 22
  • 89
  • 145
16
votes
3 answers

C++'s "inline" - how strong a hint is it for GCC and Clang/LLVM?

In C++, the keyword "inline" serves two purposes. First, it allows a definition to appear in multiple translation units. Second, it's a hint to the compiler that a function should be inlined in the compiled code. My question: in code generated by…
emchristiansen
  • 3,248
  • 3
  • 21
  • 38
16
votes
3 answers

C#: Why is a function call faster than manual inlining?

I have measured the execution time for two ways of calculating the power of 2: 1) Inline result = b * b; 2) With a simple function call result = Power(b); When running in Debug mode, everything is as expected: Calling a function is considerably…
Knasterbax
  • 6,919
  • 1
  • 24
  • 23
9
votes
1 answer

Rmarkdown: writing inline dplyr code if column names have spaces defined with backticks

Problem My inline code chunk breaks when I filter() or select() a column name that has white space that I would normally define with backticks in dplyr. Example Data ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) …
sullij
  • 176
  • 5
9
votes
3 answers

Is there any way to declaratively pass code-behind property values to server controls?

Can anyone explain why you can’t use inline code blocks within server control declarations in ASP.Net? The following is a simple example... ....
Andy McCluggage
  • 34,336
  • 18
  • 56
  • 67
8
votes
5 answers

How to use inline JavaScript in HTML?

Support that I have this hidden field: And imagine that I fetch an HTML fragment from server via jQuery AJAX.
However, instead of…
Saeed Neamati
  • 33,583
  • 40
  • 128
  • 183
8
votes
4 answers

Calling the original Page_Load function from inline code

I like to Monkey patch a ASPX website so that I can add stuff to the Page_Load method within a compiled assembly. My first thought was to add a script tag containing a second Page_Load method to the ASPX file like so: