<p>I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ?</p>

<p>The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to the question though.</p>

[{'answer_id': 48522, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 4, 'selected': True, 'text': '<p>Databinding expects an IEnumerable object, because it enumorates over it just like a foreach loop does.</p>\n\n<p>So to do this, just wrap your single object in an IEnumerable.</p>\n\n<p>Even this would work:</p>\n\n<pre><code>DataBindObject.DataSource = new List&lt;YourObject&gt;().Add(YourObjectInstance);\n</code></pre>\n'}, {'answer_id': 48523, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 1, 'selected': False, 'text': '<p>In ASP.NET2.0 you can use the generic collections to make this single object\na list of only one object in it that you can databind to any server control\nusing the objectdatasource, e.g.</p>\n\n<pre><code>List&lt;clsScannedDriverLicense&gt; DriverLicenses = new\nList&lt;clsScannedDriverLicense&gt;();\n//this creates a generic collection for you that you can return from\n//your BLL to the ObjectDataSource\nDriverLicenses.Add(TheOneObjectThatYouHaveofType_c lsDriverLicense);\n</code></pre>\n\n<p>Then your ObjectDataSource would look like that:</p>\n\n<pre><code>&lt;asp:ObjectDataSource ID="odsDL" runat="server"\nSelectMethod="OrdersByCustomer"\nTypeName="YourBLL.UtiltiesClassName"\nDataObjectTypeName="clsScannedDriverLicense"&gt;\n&lt;/asp:ObjectDataSource&gt;\n</code></pre>\n\n<p><a href="http://www.velocityreviews.com/forums/t122605-can-you-still-databind-to-a-single-object-in-asp-net-20.html" rel="nofollow noreferrer">Source</a></p>\n'}, {'answer_id': 48595, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': "<p>I don't think you have much choice other than using an class that implements IEnumerable&lt;T&gt;. Even if the DataSource property was smart enough to take a scalar object, it would probably convert it internally to a vector.</p>\n\n<p>I would however consider using a simple array rather than a List&lt;T&gt; as this will result in fewer memory allocations. If you don't like the array syntax (and also to increase readability) you could use a helper method:</p>\n\n<p>T[] DataSourceHelper::ToVector(T scalar) {\n    return new T[] { scalar };\n  }</p>\n"}, {'answer_id': 2869610, 'author': 'Jason Kleban', 'author_id': 162273, 'author_profile': 'https://Stackoverflow.com/users/162273', 'pm_score': 1, 'selected': False, 'text': '<p>I\'m after the same thing you are.  I\'ve posted a new question <a href="https://stackoverflow.com/questions/2854234/two-way-databinding-of-a-custom-templated-asp-net-control">Two-way databinding of a custom templated asp.net control</a> that has a bit of a lead.  See what you can make of it...</p>\n'}, {'answer_id': 3326610, 'author': 'Francisco Aquino', 'author_id': 187126, 'author_profile': 'https://Stackoverflow.com/users/187126', 'pm_score': 0, 'selected': False, 'text': '<p>Using this in my formView:</p>\n\n<pre><code>databoundControl.DataSource = new [] { singleObject };\ndataboundControl.DataBind();\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/48521', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4694/']