当我这样做的时候,我得到了一个ArgumentException (Value does not fall within the expected range.):
var str = ResourceLoader.GetForCurrentView().GetString(resource);其中resource的值为"Playlists:"。
因此,我猜想冒号在ResourceLoader中是不允许的,因为我有另一个带有冒号的resource,我想检索这个冒号,但实际上一无所获。
那么如何在ResourceLoader.GetString中使用冒号呢?
发布于 2019-10-17 03:32:43
只是在黑暗中捅了一下..。你试过"Playlists%3A"了吗?因为它们被视为URI片段。
ResourceLoader.GetString(String)方法
Note 资源标识符被视为统一资源标识符(URI)片段,这取决于统一资源标识符(URI)语义。例如,
GetString("Caption%20")被视为GetString("Caption ")。不要在资源标识符中使用"?"或"#",因为它们终止了指定的资源路径。例如,"Foo?3"被视为"Foo"。
https://stackoverflow.com/questions/58424314
复制相似问题