These are the advantages of each approach:
Advantages of GetGlobalResourceObject
(and GetLocalResourceObject
):
- You can specify a particular culture instead of using the CurrentCulture.
- You can use a late-bound expression (i.e. a string) to decide which resource to load. This is useful if you can't know ahead of time which resource you will need to load.
- It works with any resource provider type. For example, it works not only with the built-in default RESX-based provider but it'll work the same against a database-based provider.
Advantages of strongly-typed RESX types:
- You get compile-time errors if you access a resource that doesn't exist.
- You get Intellisense while working on the project.
So, as with many "which is best" questions, the answer is: It depends! Choose the one that has advantages that will benefit your particular scenarios the most.