coders-project.blogspot.com
Practical C# Codes: July 2008
http://coders-project.blogspot.com/2008_07_01_archive.html
Thursday, July 31, 2008. Implementing Interfaces in C#. Interfaces are a set of methods, properties and event that provides functionalities. This interces can be implemented by C# classes or structures. Interfaces do not provide methods of their own. They only contain methods identifiers, return values and parameters. This is very useful when you have certain behaviour that need to follow a set of operations, such as manipulating a Data Base. C# classes are allowed to implement many interfaces. This exam...
coders-project.blogspot.com
Practical C# Codes: May 2008
http://coders-project.blogspot.com/2008_05_01_archive.html
Friday, May 30, 2008. Advance C# programming, overload unary plus. C# let’s you overload the behaviour of some unary operator such as: unary plus, minus, prefix increment, decrement, true keyword, false keyword and more. Let’s make now a small example:. First we create a small class and define the overload plus:. MyCvalue = -Mc.value;. MyCvalue = Mc.value;. Both negative and positive values to see effect. MyCsvalue = -10.80;. MyCsPvalue = 300;. Using the operator triggers the method. MyCs = MyCs;. To mak...
coders-project.blogspot.com
Practical C# Codes: More XML options in C#
http://coders-project.blogspot.com/2010/07/more-xml-options-in-c.html
Tuesday, July 20, 2010. More XML options in C#. Continuing the xml posts, in this oportunity I will show you more options to create your XmlDocument. Here we will see:. Adding comment to the xml document (XmlComment). Adding information about the document Type (XmlDocumentType). And also, declarations and elements. XmlDec = xmlDoc.CreateXmlDeclaration( "1.0". Root = xmlDoc.CreateElement( "root-element". Adding info about the document type. DocType = xmlDoc.CreateDocumentType( "BOOKS". This is actually ve...
coders-project.blogspot.com
Practical C# Codes: Converting XML to String
http://coders-project.blogspot.com/2010/07/converting-xml-to-string.html
Saturday, July 24, 2010. Converting XML to String. In this short post I will show you how to convert XML to String, o viceversa, in order for example, to send it via Tcp/Ip. In this example, a Client is going to genereta a XML Document and convert it to string. The Server side must recive the string and generate the XML. Here you will not see how the communication is done, for example the convertion between string and stream). XmlDoc.Load( @"C: XML ". Getting the Xml as String. InnerXml = response;.
coders-project.blogspot.com
Practical C# Codes: November 2008
http://coders-project.blogspot.com/2008_11_01_archive.html
Friday, November 28, 2008. Adding new line to a txt file in C# .Net. In this very short article I will show you the easiest way to add a. New text line on a txt file using C# .NET. Then I started working with locks. There are a couple of locks, the lock when you read and the lock when you write. This is good stuff to talk later but not right now. So what is the easiest solution to this matter, here it is:. Yes, just like that. And if you want to read the txt file, you could do something like this:. Delet...
coders-project.blogspot.com
Practical C# Codes: Get integer sequence primary key in C#
http://coders-project.blogspot.com/2009/04/get-integer-sequence-primary-key-in-c.html
Saturday, April 18, 2009. Get integer sequence primary key in C#. Here is a nice method of getting the primary key from a table. Basicly what I do here is obtanning the first available key to insert new rows with this obtained key. First we set the instance of the connection with the database and then we create a sql command. After this, we open the connection and execute the command directly to the database. Select * From Oid". OidNum = 0;. OidNum = ( int. UPDATE Oid SET lastOid=". OidNum, conn);. Here ...
coders-project.blogspot.com
Practical C# Codes: Split function in C#
http://coders-project.blogspot.com/2010/05/split-function-in-c.html
Saturday, May 8, 2010. Split function in C#. Here is a small post about using split function in c#. We are going to split a String by using delimiters. A delimiter will tell when to split the string. So here is a fragment of code to perform splitting. Answer = "This$is a string". Words = answer.Split(delimitator1);. WriteLine( "First word : ". Note that now we split the second part of the string. AllRest = words[1];. Rest1 = allRest.Split(delimitator2);. WriteLine( "Second word : ". This is as simple.
coders-project.blogspot.com
Practical C# Codes: Xml Document creation using DOM
http://coders-project.blogspot.com/2010/07/xml-document-creation-using-dom.html
Friday, July 16, 2010. Xml Document creation using DOM. In this article I´ll show you how to create a .xml document using proper tags and definitions. To do this you need to import the System.Xml library. The idea is simple and the best way to learn this is by a small example. Here I´ll create a XmlDocument with a couple of child elements. First, create the declaration. Declaration = xmlDoc.CreateXmlDeclaration( "1.0". Books = xmlDoc.CreateElement( "BOOK". Child 1 for BOOK. Child 2 for BOOK. In C# you ar...
coders-project.blogspot.com
Practical C# Codes: July 2010
http://coders-project.blogspot.com/2010_07_01_archive.html
Saturday, July 24, 2010. Converting XML to String. In this short post I will show you how to convert XML to String, o viceversa, in order for example, to send it via Tcp/Ip. In this example, a Client is going to genereta a XML Document and convert it to string. The Server side must recive the string and generate the XML. Here you will not see how the communication is done, for example the convertion between string and stream). XmlDoc.Load( @"C: XML ". Getting the Xml as String. InnerXml = response;.
coders-project.blogspot.com
Practical C# Codes: April 2008
http://coders-project.blogspot.com/2008_04_01_archive.html
Monday, April 28, 2008. Deleting elements from a list while iterating. In C# you are not allowed to iterate and delete elements from a list at the same time. So what you need to do is to find a way to delete these elements later, after knowing what you are going to eliminate. In C you won’t have this problem but in C# an exception will be triggered. New list that will contain the Objects to be deleted later on. ListAll contains all the Element objects. Location = e.loc;. Sunday, April 20, 2008. Here we d...