IVsaPersistSite.LoadElement Method
Gets the source string previously saved using the IVsaPersistSite.SaveElement method.
public: String* LoadElement(
String* Name
);
public string LoadElement(
string Name
);
MustOverride Public Function LoadElement( _
ByVal Name As String _
) As String
Parameters
- name
The name of the code item to be loaded. This can be a null reference when loading the Project file.
Return Value
Returns the contents of the source-code element associated with the name parameter.
Remarks
Calls to IVsaEngine.SaveSourceState cause the script engine to send a number of items back to the host. These items will usually, but not always, have an associated name. The engine guarantees that it will call back for these same items using these same names when it later calls the IVsaEngine.LoadSourceState method.
The order in which items are saved and loaded is not guaranteed to be the same every time save and load operations occur, and nothing semantic is implied by the order in which items are loaded or saved. It is the host's responsibility to persist and re-load items identically, byte-for-byte, when making calls to SaveSourceState and LoadSourceState.
The name parameter must be the valid name of a previously saved element, or, if you are loading the Project file, it must be a null reference.
The following table shows the exceptions that the LoadElement method can throw.
Exception Type |
Condition |
---|---|
ElementNotFound |
There was no element with the given name parameter to load. |
ElementNameInvalid |
The element name is not valid, for example, it contains characters that are not valid. |
CallbackUnexpected |
The call was made outside of a call to the IVsaEngine.LoadSourceState method. |
LoadElementFailed |
The element failed. Check System.InnerException for more information. |
See Also
Reference
IVsaEngine.LoadSourceState Method