Represents a link to an external resource.
See the Remarks section for the differences compared to System.Resources.ResXFileRef class.
See the Remarks section for the differences compared to System.Resources.ResXFileRef class.
Inheritance Hierarchy
KGySoft.ResourcesResXFileRef
Namespace: KGySoft.Resources
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-preview.3
Syntax
The ResXFileRef type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | ResXFileRef |
Initializes a new instance of the ResXFileRef class that references the specified file.
|
Properties
Name | Description | |
---|---|---|
![]() | FileName |
Gets the file name specified in the constructor.
|
![]() | TextFileEncoding |
Gets the encoding specified in the constructor.
|
![]() | TypeName |
Gets the type name specified in the constructor.
|
Methods
Name | Description | |
---|---|---|
![]() ![]() | Parse |
Converts the string representation of a file reference to a ResXFileRef instance.
|
![]() | ToString |
Gets the text representation of the current ResXFileRef object.
(Overrides ObjectToString.) |
![]() ![]() | TryParse |
Converts the string representation of a file reference to a ResXFileRef instance. A return value indicates whether the conversion succeeded.
|
Extension Methods
Name | Description | |
---|---|---|
![]() | Convert(Type, CultureInfo) | Overloaded.
Converts an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example. |
![]() ![]() | ConvertTTarget(CultureInfo) | Overloaded.
Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Remarks section for details. |
![]() | In |
Gets whether item is among the elements of set.
(Defined by ObjectExtensions.)See the Examples section of the generic InT(T, T) overload for an example. |
![]() | TryConvert(Type, Object) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvert(Type, CultureInfo, Object) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvertTTarget(TTarget) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvertTTarget(CultureInfo, TTarget) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
Remarks
![]() |
---|
This class is similar to System.Resources.ResXFileRef in System.Windows.Forms.dll. See the Comparison with System.Resources.ResXFileRef section for the differences. |
The ResXFileRef class is used to include references to files in an XML resource (.resx) file. A ResXFileRef object represents a link to an external resource in an XML resource (.resx) file. You can add a ResXFileRef object to a .resx file programmatically by one of the following options:
- Call the ResXResourceWriter.AddResource(string, object) method where the second parameter is a ResXFileRef instance.
- Call the ResXResourceSet.SetObject(string, object) method where the second parameter is a ResXFileRef instance and then save the ResXResourceSet instance.
- Call the ResXResourceManager.SetObject(string, object, CultureInfo) method where the second parameter is a ResXFileRef instance and then save the ResXResourceManager instance.
- Call the HybridResourceManager.SetObject(string, object, CultureInfo) method where the second parameter is a ResXFileRef instance and then save the HybridResourceManager instance.
- Call the HybridResourceManager.SetObject(string, object, CultureInfo) method where the second parameter is a ResXFileRef instance and then save the DynamicResourceManager instance.
Comparison with System.Resources.ResXFileRef
![]() |
---|
The compatibility with System.Resources.ResXFileRef is provided without any reference to System.Windows.Forms.dll, where that type is located. |
![]() |
---|
When serialized in compatibility mode (see ResXResourceWriter.CompatibleFormat, ResXResourceSet.Save, ResXResourceManager.SaveResourceSet and ResXResourceManager.SaveAllResources), the result will be able to be parsed by the System.Resources.ResXFileRef type, too. |
Incompatibility with System.Resources.ResXFileRef:
- The constructor is incompatible with System.Resources.ResXFileRef implementation. Unlike in system version you must specify the type by a Type instance instead of a string.
New features and improvements compared to System.Resources.ResXFileRef:
- Parsing - A string can parsed to a ResXFileRef instance by Parse(String) and TryParse(String, ResXFileRef) methods.
![]() |
---|
The TypeConverter that is assigned to the ResXFileRef type may load assemblies when its ConvertFrom method is called. The recommended way to retrieve a file resource is via the ResXDataNode class. Its GetValueSafe method guarantees that no assembly is loaded during the deserialization, including retrieving resources from file references. |
See Also