Fills an
ObjectSet with all the objects of the given type.
Syntax
| Visual Basic (Declaration) | |
|---|
Overloads Public Overridable Function GetObjectSet(Of T)() As ObjectSet(Of T) |
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As ObjectContext
Dim value As ObjectSet(Of T)
value = instance.GetObjectSet(Of T)()
|
| Managed Extensions for C++ | |
|---|
public: virtual ObjectSet<T>* GetObjectSet<T>(); |
| C++/CLI | |
|---|
public:
virtual ObjectSet<T>^ GetObjectSetgeneric<typename T>
(); |
Type Parameters
- T
Return Value
An instance of an
ObjectSet filled with the objects from the storage.
Example
The following example introduces to the use of the GetObjectSet 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. // Get the ObjectSet with user matching the name and sorting them by name. ObjectSet<User> objectSet = context.GetObjectSet<User>(); // Loop through all items and do something. foreach(User user in objectSet) { // Do something. } |
Remarks
Requirements
Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family
See Also