Fills an instance of a class that implements the
IList
interface with objects.
Syntax
| Visual Basic (Declaration) | |
|---|
Overloads Public Overridable Function GetObjectList(Of T)( _
ByVal list As IList(Of T), _
ByVal query As IQuery _
) As IList(Of T) |
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As ObjectContext
Dim list As IList(Of T)
Dim query As IQuery
Dim value As IList(Of T)
value = instance.GetObjectList(Of T)(list, query)
|
| Managed Extensions for C++ | |
|---|
public: virtual IList<T>* GetObjectList<T>(
IList<T>* list,
IQuery* query
) |
| C++/CLI | |
|---|
public:
virtual IList<T>^ GetObjectListgeneric<typename T>
(
IList<T>^ list,
IQuery^ query
) |
Parameters
- list
- An instance of a class that implements the IList
interface.
- query
-
An instance of a class that implements the
IQuery interface. This query is compiled and used
to retrieve the objects from the storage.
Type Parameters
- T
Return Value
The instance of a class that implements the
IList
interface.
Exceptions
| Exception | Description |
| ArgumentNullException | List is null. |
Example
The following example introduces to the use of the GetObjectList routine.
| C# | Copy Code |
|---|
// Creates a new ObjectContext that uses an MsSql Server as storage. ObjectContext context = new ObjectContext(new MsSqlStorage("sa", "", "localhost", "application")); // ... Other code. // Gets all object matching the name and sorting them by name. IList<User%gt; userList = null; userList = context.GetObjectReader<User>(new List<User>(), new ObjectQuery<User>("Name like {0} SortBy Name Asc", "%mith%")); // Loop through all items and do something. foreach(User user in userList) { // Do something. } |
Remarks
Requirements
Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family
See Also