In [this Microsoft article](https://learn.microsoft.com/en-us/aspnet/core/blazor/performance?view=aspnetcore-6.0#define-reusable-renderfragments-in-code), they show how to extract a piece of Blazor code into a method so that it can be reused. They show the following example...

```xml
<h1>Hello, world!</h1>

@RenderWelcomeInfo

<p>Render the welcome info a second time:</p>

@RenderWelcomeInfo

@code {
    private RenderFragment RenderWelcomeInfo = __builder =>
    {
        <p>Welcome to your new app!</p>
    };
}

```

They then go on to explain that if you want to extract this method into a separate `.razor` file, you can make it `static`.

That's all fine for a simple example such as the ones they show, but if you want to anything realistic, chances are you will need to pass at least one parameter to the method.

However, if you change their `SayHello` example to take a parameter...

```cs
  public static RenderFragment SayHelloName(string name) = __builder => {
    <h1>Hello @name</h1>
  };

```

...then you get an interesting mix of compiler errors...

* The `=` sign has a red underline, and hovering over it gives an error *Function body expected*
* The variable `__builder` is highlighted in red, and hovering over it gives an error *Cannot resolve symbol `__builder`*
* The space right after the variable `__builder` is highlighted in red, and hovering over it gives an error *Cannot resolve symbol `__builder`\n\nUnexpected token*
* The `=>` has a red underline, and hovering over that gives an error *Not all code paths return a value in lambda expression of type 'RenderFragment'* (which is interesting, as the return type doesn't have a generic type)
* The usage of `name` in the body of the method is red with an error *Cannot resolve symbol 'name'*
* The `};` right at the end is underlined in red and shows an error of *} expected*, with the opening braces being the class declaration.

To confuse matters more, only the 4th and 5th of these errors show up in the Error panel, albeit with slightly different wording.

Following the example show in [Telerik's KB](https://docs.telerik.com/blazor-ui/knowledge-base/grid-dynamic-column-template), I tried the following...

```cs
  public static RenderFragment<object> SayHelloName(string name) => context => __builder   => {
    <h1>Hello @name</h1>
  };

```

However, when I try to use this...

```html
<div>@SayHelloName("Jim")</div>

```

...the following is rendered on the page...

```
Microsoft.AspNetCore.Components.RenderFragment`1[System.Object]

```

...instead of "Hello Jim" as I expected.

Anyone able to explain what I'm doing wrong? How do I extract a RenderFragment method that takes parameters into a separate class?