When trying to use Humanizer in a Blazor Razor Page

// _Imports.razor
@using Humanizer;

// Page.razor
@file.Size.Bytes.ToString()

I get this error:

Error   CS0119  'ByteSizeExtensions.Bytes(byte)' is a method, which is not valid in the given context

Using Humanizer without a Razor page, directly in standard c# code, works fine. Why do I get this error? How to fix it?

1

There are 1 best solutions below

0
On

Solution: It needs to be

@file.Size.Bytes().ToString()

instead of

@file.Size.Bytes.ToString()