Chili.Opf3 Send comments on this topic.
FindOne() Method
See Also  Example
Chili.Opf3 Namespace > Generic ObjectSearcher Class > FindOne Method : FindOne() Method




Returns the first persistent object of the generic type that are found in the storage. Or default(T) if no item has been found.

Syntax

Visual Basic (Declaration) 
Overloads Public Overridable Function FindOne() As T
Visual Basic (Usage)Copy Code
Dim instance As ObjectSearcher(Of T)
Dim value As T
 
value = instance.FindOne()
C# 
public virtual T FindOne()
Managed Extensions for C++ 
public: virtual T FindOne(); 
C++/CLI 
public:
virtual T FindOne(); 

Example

The example shows how this method is used in your application code.
C#Copy Code
            [Persistent("USER")] 
public class User 

    private string _name = null; 
 
    [Field("NAME")] 
    public string Name 
    { 
        get { return _name; } 
        set { _name = value; } 
    } 
 
    // ... Other properties and fields. 

 
// ... Other code 
 
// Get the ObjectSearcher for User. 
ObjectSearcher<User> searcher = context.GetObjectSearcher<User>(); 
// Find the first user in the storage. 
User user = searcher.FindOne(); 
    

Requirements

Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family

See Also