How to create region in Blazor?

Viewed 504

How can i create a region to my code in blazor?

I try this:

#region Test
 'code'
#endregion 

And don't result i cannot "close" and "open" code in region.

2 Answers

#region code folding is currently not supported within Razor pages.

There is a known issue as posted here. We therefor can assume that this will be catered for in a future update. I do not see it in the version 17.2 roadmap, so it might only happen at a later stage. Keep an eye on their GitHub.

You can use Region in normal code classes in Blazor. Though not stated, I assume you are referring to Razor components. These are Razor files, not C# class files, and the Region syntax does not exist.

If you want to use regions in the code in razor files, you can in code-behind partial classes.

Related