<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C#</title><link>http://forums.asp.net/37.aspx</link><description>Discussions/Questions about the C# language. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=13&amp;c=23" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3300811.aspx</link><pubDate>Fri, 17 Jul 2009 23:54:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3300811</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3300811.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3300811</wfw:commentRss><description>&lt;p&gt;really?&amp;nbsp; Because I can pick peoples brains for hours............................&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;the amended code that you put up for VS2005 didnt work...&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3300288.aspx</link><pubDate>Fri, 17 Jul 2009 17:40:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3300288</guid><dc:creator>JeffreyABecker</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3300288.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3300288</wfw:commentRss><description>&lt;p&gt;Honestly I like this sort of thread.&amp;nbsp; Its a great distraction over my lunch break.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3298506.aspx</link><pubDate>Fri, 17 Jul 2009 00:02:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3298506</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3298506.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3298506</wfw:commentRss><description>&lt;p&gt;thanks for the feedback :)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;i have inheritance down pack :) that took me a fair while to get.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I still cant get your code to work - still getting errors - i think i might leave it - one day i might get it....&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thank you for your help, you have been very patient and i do not wish to bother you any more then I already have...&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3298046.aspx</link><pubDate>Thu, 16 Jul 2009 18:49:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3298046</guid><dc:creator>JeffreyABecker</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3298046.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3298046</wfw:commentRss><description>&lt;p&gt;It all boils down to abstraction, encapsulation and polymorphism.&amp;nbsp; To some extent interfaces get you all three.&amp;nbsp; Dont worry, about not &amp;#39;getting it&amp;#39;.&amp;nbsp; This stuff is HARD.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3296075.aspx</link><pubDate>Thu, 16 Jul 2009 01:23:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3296075</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3296075.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3296075</wfw:commentRss><description>&lt;p&gt;on hind sight - i dont ever think i will understand interfaces :(&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;and i have a feeling that isnt a good thing either&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3295912.aspx</link><pubDate>Wed, 15 Jul 2009 22:33:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3295912</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3295912.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3295912</wfw:commentRss><description>&lt;p&gt;ah the penny drops about interfaces.....i think&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I tried looking at the code here..but its still the same error&lt;br /&gt;&lt;/p&gt;&lt;p&gt;http://pastebin.com/f20fcc5ca&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3294919.aspx</link><pubDate>Wed, 15 Jul 2009 13:18:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3294919</guid><dc:creator>JeffreyABecker</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3294919.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3294919</wfw:commentRss><description>&lt;p&gt;Right, no automatic property implementations in 2k5.&amp;nbsp; Try now.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The reason to use an interface is mostly about abstraction.&amp;nbsp; The interface keeps everyone honest.&amp;nbsp; Consuming classes dont know about details or extra members that the implementing class exposes so they cant call them.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3293410.aspx</link><pubDate>Tue, 14 Jul 2009 21:31:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3293410</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3293410.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3293410</wfw:commentRss><description>&lt;p&gt;for the new code that you pasted up&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;i get these errors&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;1&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#39;JB.DbExample.DbArg.Name.get&amp;#39; must declare a body because it is not marked abstract or extern&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;28&amp;nbsp;&amp;nbsp; &amp;nbsp;30&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;2&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#39;JB.DbExample.DbArg.Name.set&amp;#39; must declare a body because it is not marked abstract or extern&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;28&amp;nbsp;&amp;nbsp; &amp;nbsp;35&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;3&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#39;JB.DbExample.DbArg.Value.get&amp;#39; must declare a body because it is not marked abstract or extern&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;29&amp;nbsp;&amp;nbsp; &amp;nbsp;31&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;4&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#39;JB.DbExample.DbArg.Value.set&amp;#39; must declare a body because it is not marked abstract or extern&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;29&amp;nbsp;&amp;nbsp; &amp;nbsp;36&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3293405.aspx</link><pubDate>Tue, 14 Jul 2009 21:28:06 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3293405</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3293405.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3293405</wfw:commentRss><description>&lt;p&gt;Hey Jeffery,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;sorry about the delay in response, life is a little un-organised at the moment&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;1.) i added a .CS file to my app_code &lt;/p&gt;&lt;p&gt;2.) i pasted in&amp;nbsp; the code&lt;/p&gt;&lt;p&gt;3.) ctrl + shift +b (build the code) and it came up with these errors&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;1&amp;nbsp;&amp;nbsp; &amp;nbsp;Type expected&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;90&amp;nbsp;&amp;nbsp; &amp;nbsp;36&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;2&amp;nbsp;&amp;nbsp; &amp;nbsp;Identifier expected, &amp;#39;string&amp;#39; is a keyword&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;90&amp;nbsp;&amp;nbsp; &amp;nbsp;56&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;3&amp;nbsp;&amp;nbsp; &amp;nbsp;Identifier expected, &amp;#39;object&amp;#39; is a keyword&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;90&amp;nbsp;&amp;nbsp; &amp;nbsp;73&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;4&amp;nbsp;&amp;nbsp; &amp;nbsp;; expected&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;90&amp;nbsp;&amp;nbsp; &amp;nbsp;88&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;5&amp;nbsp;&amp;nbsp; &amp;nbsp;Invalid token &amp;#39;(&amp;#39; in class, struct, or interface member declaration&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;92&amp;nbsp;&amp;nbsp; &amp;nbsp;27&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;6&amp;nbsp;&amp;nbsp; &amp;nbsp;Invalid token &amp;#39;,&amp;#39; in class, struct, or interface member declaration&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;92&amp;nbsp;&amp;nbsp; &amp;nbsp;36&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;7&amp;nbsp;&amp;nbsp; &amp;nbsp;Class, struct, or interface method must have a return type&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;92&amp;nbsp;&amp;nbsp; &amp;nbsp;38&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;8&amp;nbsp;&amp;nbsp; &amp;nbsp;Identifier expected&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;92&amp;nbsp;&amp;nbsp; &amp;nbsp;64&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;9&amp;nbsp;&amp;nbsp; &amp;nbsp;; expected&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;92&amp;nbsp;&amp;nbsp; &amp;nbsp;65&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;10&amp;nbsp;&amp;nbsp; &amp;nbsp;Expected class, delegate, enum, interface, or struct&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;94&amp;nbsp;&amp;nbsp; &amp;nbsp;23&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;11&amp;nbsp;&amp;nbsp; &amp;nbsp;Expected class, delegate, enum, interface, or struct&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;98&amp;nbsp;&amp;nbsp; &amp;nbsp;23&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;12&amp;nbsp;&amp;nbsp; &amp;nbsp;Expected class, delegate, enum, interface, or struct&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;102&amp;nbsp;&amp;nbsp; &amp;nbsp;23&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;13&amp;nbsp;&amp;nbsp; &amp;nbsp;Type or namespace definition, or end-of-file expected&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;224&amp;nbsp;&amp;nbsp; &amp;nbsp;1&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;VS2005 Pro&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;======================&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;just on a side question - answer only if you feel like it,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;what if you just set up a class that had methods, that returned datasets? why would you use an interface class?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3292583.aspx</link><pubDate>Tue, 14 Jul 2009 13:50:55 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3292583</guid><dc:creator>JeffreyABecker</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3292583.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3292583</wfw:commentRss><description>&lt;p&gt;Theres actually very little in there thats 3.5 specific.&amp;nbsp; What version of visual studio are you running and what type of project do you have set up?&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Heres a version w/ all the 3.5 specific stuff pulled out: &lt;a href="http://pastebin.com/f20fcc5ca"&gt;http://pastebin.com/f20fcc5ca&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;usage is something like:&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;using(IDbManager db = DbManagerFactory.GetDbManager(&amp;quot;Northwind&amp;quot;))
{
	DataSet ds = db.Exec(&amp;quot;getSalesPersonByName&amp;quot;, new DbArg(&amp;quot;name&amp;quot;,&amp;quot;Bob&amp;quot;));
}&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3289319.aspx</link><pubDate>Mon, 13 Jul 2009 06:39:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3289319</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3289319.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3289319</wfw:commentRss><description>&lt;p&gt;i could not get this to work&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;was this designed for .net 2.0 - i dont think so as it has link&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;do you have a version for 2.0? &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3275685.aspx</link><pubDate>Sun, 05 Jul 2009 23:23:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275685</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275685.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3275685</wfw:commentRss><description>&lt;p&gt;ah yes you are right i am confusing the interface class with implementation class :)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I am going to have a go at working with the code....and see if i can get it to work&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;and see what i can bind :) thanks heaps&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3275608.aspx</link><pubDate>Sun, 05 Jul 2009 20:04:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275608</guid><dc:creator>JeffreyABecker</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275608.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3275608</wfw:commentRss><description>&lt;p&gt;also, I noticed a bug where I was forgetting to setup transactions.&amp;nbsp; Please take a look at the updated pastebin&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3275605.aspx</link><pubDate>Sun, 05 Jul 2009 19:56:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275605</guid><dc:creator>JeffreyABecker</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275605.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3275605</wfw:commentRss><description>&lt;p&gt;first a little note on interfaces:&lt;br /&gt;The interface I declared is functionally equivlent to:&lt;/p&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;/pre&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;public abstract class IDbManager : IDisposable
{
    public abstract DataSet Exec(string procName, params DbParameter[] args);
    public abstract DataSet ExecDynamicSql(string sql, params DbParameter[] args);
    public abstract T Scalar&amp;lt;T&amp;gt;(string procName, params DbParameter[] args);
    public abstract T ScalarDynamicSql&amp;lt;T&amp;gt;(string sql, params DbParameter[] args);
    public abstract void Begin();
    public abstract void Commit();
    public abstract void Rollback();
    public abstract void Dispose();
}&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;In C# you can only ever inherit from one &lt;i&gt;class&lt;/i&gt;, but you can implement multiple interfaces.&amp;nbsp; So its better to declare such things as interfaces.&amp;nbsp; Also, classes that inherit from such interfaces are said to &amp;#39;implement&amp;#39; them.&lt;br /&gt;&lt;br /&gt;====&lt;/p&gt;&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;WPHC:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;So by that you mean an interface class is always inherited (i just read up on interfaces now and understand them a bit better - although they still confuse me)&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Exactly.&amp;nbsp; You cant actually put any implementation in an interface.&amp;nbsp; the compiler will start throwing errors.&lt;/p&gt;&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;WPHC:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;correct me if i am wrong (and i will take your word over mine) but from my reading, my understanding is that Interface classes are not supposed(should not?) &lt;br /&gt;to contain any &amp;#39;body&amp;#39; connection code? Although i do understand why you did this, because if you ever swap dbases all you have to do is change it in the one spot, instead of&lt;br /&gt;the whole application.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;I think you might be getting confused between the interface and the class which &amp;#39;implements&amp;#39; it.&amp;nbsp; &lt;/p&gt;&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;WPHC:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;That one i knew, but i think i was asking a different question&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Oh, umm yes that function is for executing straight sql that isnt a stored procedure?&lt;/p&gt;&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;WPHC:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;This one i still donot get - even after i have looked through my reading material, do you have a link which would give me a starting point?&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;I think the microsoft tutorial on generics is a good start:&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms379564.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms379564.aspx&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: functions vs properties</title><link>http://forums.asp.net/thread/3275003.aspx</link><pubDate>Sat, 04 Jul 2009 23:40:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275003</guid><dc:creator>WPHC</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275003.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=3275003</wfw:commentRss><description>&lt;p&gt;&lt;br /&gt;&lt;br /&gt;line 11)Right.&amp;nbsp; This class is the class that actually &amp;#39;implements&amp;#39; the interface.&amp;nbsp; Remember, interfaces are completly abstract.&amp;nbsp; you can never actually instantiate one directly.&amp;nbsp; instead you must create a class that implements that interface and instantiate that.&amp;nbsp; SqlDbManager is the class that does the implementation.&lt;br /&gt;&lt;br /&gt;//**************So by that you mean an interface class is always inherited (i just read up on interfaces now and understand them a bit better - although they still confuse me)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;line 20 / 27) The IDbManager interface abstracts away a lot of stuff.&amp;nbsp; Most importantly it completely hides connection management. &amp;nbsp;&lt;br /&gt;This particular line simply sets the connection string that this implementation will use.&amp;nbsp; Then the first time someone trys to do anything the connection is opened. &amp;nbsp;&lt;br /&gt;I use a method here because of the transaction management portion of the interface.&amp;nbsp; If I simply opened and closed a connection in each call, &lt;br /&gt;1) performace could start sucking 2) You couldnt do transactions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//**************correct me if i am wrong (and i will take your word over mine) but from my reading, my understanding is that Interface classes are not supposed(should not?) &lt;br /&gt;to contain any &amp;#39;body&amp;#39; connection code? Although i do understand why you did this, because if you ever swap dbases all you have to do is change it in the one spot, instead of&lt;br /&gt;the whole application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;line 40)&amp;nbsp; Yes.&amp;nbsp; My personal experience is that DataReaders are a lot of work, for very little payoff.&amp;nbsp; My expericene is that &amp;#39;use data readers&amp;#39; is premature optimization. &amp;nbsp;&lt;br /&gt;I once had an app that used data sets which performed poorly.&amp;nbsp; The admonition came down to rewrite it to use data readers.&amp;nbsp; 2 weeks later, &lt;br /&gt;I had an app which was much harder to understand and still preformed poorly.&amp;nbsp; When we actually profiled the app, it turned out we were performing O(N^2) operations on much &lt;br /&gt;larger data structures that were originally envisioned.&amp;nbsp; If you wanted something other than a DataSet out of the methods, I&amp;#39;d suggest IEnumerable&amp;lt;IDataRecord&amp;gt;. &amp;nbsp;&lt;br /&gt;Both DataReaders and DataTables implement, or can be adapted to implement IEnumerable&amp;lt;IDataRecord&amp;gt;, but again I just prefer the DataSet api. &amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//***************** OK&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;line 41)This class is written to use SqlServer.&amp;nbsp; I believe all that would be needed to use MySql would be to add a &amp;quot;using MySql.Data.MySqlClient;&amp;quot; in place of &lt;br /&gt;&amp;quot;using System.Data.SqlClient&amp;quot; and add &amp;quot;My&amp;quot; infront of every &amp;quot;Sql&amp;quot;.&amp;nbsp; I dont really know the details of MySql though.&lt;br /&gt;&lt;br /&gt;//************ that is probably the best news i have heard all week - not because im a lazy programmer, but because I do not know enough about Interfaces yet &lt;br /&gt;(as well as that I have only just been introduced to datasets)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;line 56)Yes.&amp;nbsp; You can still parameterize sql even if its not a stored procedure.&amp;nbsp; This is infact the recomended practice.&amp;nbsp; It greatly mitigatges your risk of sql injection attacks. &amp;nbsp;&lt;br /&gt;//*********** That one i knew, but i think i was asking a different question...oh well you have been so helpful so far :) - they should promote you to moderator :) &lt;br /&gt;(at least until i get an invoice in the mail for the tuition fees :) )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;line 71/77) These two functions are &amp;#39;generic&amp;#39; functions.&amp;nbsp; C# supports parameterizing code by types similar to C++ templates.&amp;nbsp; In this case T is the type parameter for the&lt;br /&gt;&amp;nbsp;output.&amp;nbsp; These functions could be changed to return object if you&amp;#39;re more comfortable with that.&amp;nbsp; However the DataSetExtensions library provides a powerful,&lt;br /&gt;&amp;nbsp; generics based method of properly casting / converting the output of database operations.&amp;nbsp; I&amp;#39;ve found these methods to be more complete and reliable than anything &lt;br /&gt;&amp;nbsp; I&amp;#39;ve ever written.&lt;br /&gt;&lt;br /&gt;//****************************This one i still donot get - even after i have looked through my reading material, do you have a link which would give me a starting point?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thank you for helping me to understand your code, and for the explanations - on monday i will play with it and make it work&lt;/p&gt;</description></item></channel></rss>