Friday, September 29, 2006

Your Own Serviced Layer ?

Have you ever though of writting a serviced layer? well I just did.. :) I wrote a small example also .. It quit intersting... It easy if you have constat attributes in your project, if not you will be in a sup ..

I have posted the code here..


Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim myCars As New Cars
myCars.Add(New Car("SDSDSD"))

For Each b As Car In myCars
MsgBox(b.Name)
Next






End Sub
End Class

Public Class Car

Private mName As String

Public Sub New(ByVal CarName As String)
mName = CarName
End Sub

Public Property Name() As String
Get
Return mName
End Get

Set(ByVal Value As String)
mName = Value
End Set
End Property

End Class

Public Class Cars
Implements IEnumerable

Private mList As New ArrayList

Public Sub Add(ByVal bk As Car)
mList.Add(bk)
End Sub

Default Public ReadOnly Property List(ByVal index As Integer) As Car
Get
Return DirectCast(mList(index), Car)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return New CarsEnumerator(mList)
End Function

Class CarsEnumerator
Implements IEnumerator

Private index As Integer = -1

Private mList As ArrayList

Friend Sub New(ByVal list As ArrayList)
mList = list
End Sub

Public ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
Get
Return mList(index)
End Get
End Property

Public Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
If index < mList.Count - 1 Then
index += 1
Return True
Else
Return False
End If
End Function

Public Sub Reset() Implements System.Collections.IEnumerator.Reset
index = 0
End Sub
End Class
End Class

Wednesday, September 06, 2006

Tuesday, September 05, 2006

Conditional Debugging ?

 

Some thimes you have to hide some errors in the debug versions and display a nice customized message in da release versions. I found this intersting artical which explains the conditional debugging. check it out at

 

http://blogs.vandamme.com/development/archives/200...

Monday, September 04, 2006

Here is My C# Resources

 

 

Helpful C# Resources

I compiled a list of some of resources for people just starting out with C# and .NET. If you have any that you recommend, please share!

http://codeproject.com – tons of free projects available for download. This I a great resource for even the most experience programmers. There are pretty much projects detailing how to do anything (especially in windows desktop development)

http://msdn.microsoft.com/vcsharp – the official C# website at Microsoft. There are a lot of good downloads here for code snippets and sample projects. There are also links to the Microsoft community and support forums. Definitely worth a bookmark.

http://msdn.microsoft.com/vcsharp/downloads/2005 – lots of free source code to get started.

http://www.c-sharpcorner.com – another great site similar to codeproject which catalogs many thousands of lines of free code and tutorials.

http://www.csharp-station.com – great beginner tutorials for C# and ADO.NET

http://www.csharphelp.com – more code snippets than full projects but very helpful for learning quick things and fixing bugs

http://www.csharpfriends.com – another huge resource of code and tutorials

http://en.wikipedia.org/wiki/CSharpprogramming_language – basic tutorial and a lot of good links at the bottom under References.

http://blogs.msdn.com/csharpfaq – C# FAQ blog by Microsoft

http://csharp-source.net – C# resources (no code)

Pro C# 2005 and the .NET 2.0 Platform, Third Edition (Hardcover) http://www.amazon.com/gp/product/1590594193/sr=8-3/qid=1148997675/ref=pdbbs3/102-1539900-6421701?%5Fencoding=UTF8

Programming Microsoft Visual C# 2005: The Language (Paperback) http://www.amazon.com/gp/product/0735621810/sr=8-6/qid=1148997675/ref=pdbbs6/102-1539900-6421701?%5Fencoding=UTF8

Pro ADO.NET 2.0 (Expert’s Voice) (Paperback) http://www.amazon.com/gp/product/1590595122/qid=1148997798/sr=2-1/ref=pdbbsb21/102-1539900-6421701?s=books&v=glance&n=283155

Programming Microsoft ASP.NET 2.0 Core Reference (Paperback) http://www.amazon.com/gp/product/0735621764/qid=1148997822/sr=2-2/ref=pdbbsb22/102