neal stublen nstublen@jccc edu n.
Skip this Video
Loading SlideShow in 5 Seconds..
C#: Introduction for Developers PowerPoint Presentation
Download Presentation
C#: Introduction for Developers

Loading in 2 Seconds...

play fullscreen
1 / 21

C#: Introduction for Developers - PowerPoint PPT Presentation

  • Uploaded on

Neal Stublen C#: Introduction for Developers. How does XMLReader work?. XmlReader.Read () Advances to next node XmlReader properties access node name, value, attributes, etc. Returns false if there are no additional nodes. Reading XML Files.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'C#: Introduction for Developers' - tallis

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
how does xmlreader work
How does XMLReader work?
  • XmlReader.Read()
    • Advances to next node
    • XmlReader properties access node name, value, attributes, etc.
    • Returns false if there are no additional nodes
reading xml files
Reading XML Files

XmlReader r = XmlReader.Create(path, settings);






} while (r.ReadToNextSibling(nodeName));


code practice
Code Practice
  • Create a new project called CustomerImport
  • Import Customers into a List<> from any .xml file
  • Fill a TreeView with the Customer data
  • TreeView
  • XmlReader
var data type
var Data Type
  • We can declare a variable as type “var” instead of using a specific data type

The compiler assigns an implicit data type at compile-time (not run-time)

var value = 0;

var array = new string[10];

var list = new List<Customer>();

varstr = "Hello"; // str is string type

str = 6; // can’t assign int

what s linq
What’s LINQ?
  • SQL-like query expression on any enumerable object type

int[] numbers = new int[100];

for (int index = 0; index < 100; ++index)


numbers[index] = index;


var odds = from number in numbers

where number % 2 != 0

select number;

try it in linqpad
Try it in LINQPad
  • Duplicate code from previous slide
  • Filter out prime numbers from array using LINQ query
linq expressions
LINQ Expressions

from [type] element in collection

join element2 in collection2

on key1 equals key2

where condition // any boolean expression

orderby expression [ascending|descending]

select columnExpression

select new [type] { name=value, name=value }

linq expressions1
LINQ Expressions

from cust in customers

join invoice in invoices

on cust.CustomerID equals invoice.CustomerID

where invoice.InvoiceDate < sixtyDaysAgo

orderbyinvoice.InvoiceTotal descending


try it with customerimport
Try it with CustomerImport
  • Create a List<Customer> object by looping through SqlDataReader
  • Perform LINQ queries on List<Customer>
linq to sql1
  • Create objects that represent database entities
  • Use the same LINQ query expressions against a database
  • Just restricts “where” clause to SQL-compatible operations
linq on database objects
LINQ on Database Objects
  • Add LINQ data objects to a project
  • Drop tables from Server Explorer
  • Use the new DB to query the database using LINQ
  • Insert, Update, Delete objects, db.SubmitChanges()
  • Add related items, db.SubmitChanges()
  • Paging: (from…).Skip(5).Take(5)
linq d customer invoice list
LINQ’d Customer-Invoice List
  • Using LINQ objects, fill a list view with all invoices sorted by CustomerName
tooltips and helpproviders
ToolTips and HelpProviders
  • Add ToolTip control
  • Set ToolTip property on each control and/or the form
  • Hover over control to show tool tip
  • Add HelpProvider control
  • Set the HelpString on each property and/or the form
  • Press F1 while the control has focus to show help string
tab control1
Tab Control
  • Separate panels to group items
  • Tab across edge changes panel visibility