First of all, I would like to say that in C # Linq, you start with each program at the beginning of each meeting with the using System.Linq, it may be guessed that it is related to the database, but specifically unclear. Here, if you need to use a database for programming,
You need to introduce System.Data.Link. It makes the program easy to connect with the database, and the Android platform has its own database, but the performance of both of them I have no good way to compare, this point to the smart Reader!
In short, it brings a ray of light to the programmers of C #, making the dead programming a bit alive, without the hassle of configuring a variety of databases. Here for the reader's understanding, a picture of the PPT
This picture is very clear to tell you this link mechanism, engineering people to understand, Meng Meng da
Next I want to talk about all the other programmers headache problem, that is exception handling. I think it's important to judge the quality of a programmer by looking at his attitude toward the anomaly. A lot of people just throw, crash, end the program,
But the real customer is always the most fastidious person in the world, for such a bunch of people who are never satisfied, how can your product have an audience? Now look at the worst, oh, not the simplest example.
This is a simple and incredible judgment of whether the two numbers can divide the code. Typically, the type of the deepest-derived exception is processed first, and a generic exception is processed last.
Exceptions have the following characteristics:
All types of exceptions are ultimately derived from System.Exception.
Use a try block around the statement that might throw an exception .
Once an exception occurs in a try block, the control flow jumps to the first associated exception handler, regardless of where the handler exists in the call stack. in C #, thecatch keyword is used to define an exception handler.
If there is no exception handler for the given exception, the program stops execution and displays an error message.
-
do not catch the exception unless you can handle an exception and leave the application in a known state. system.exception, rethrow it using the throw keyword at the end of the catch block. " If you capture system.exception, use class= >catch "input" throw block to raise the exception again.
If a catch block defines an exception variable, you can use it to get more information about the type of exception that occurred.
Programs can use the throw keyword to explicitly throw an exception.
The exception object contains detailed information about the error, such as the state of the call stack and a textual description of the error.
-
finally block is executed even if a exception is thrown. " The code in the finally block is executed even if an exception occurs. finally block to release resources, for example to close any streams or files this were opened in the try block. " > Use the finally block to free resources, for example, to close any streams or files that are open in the try block.
Managed exceptions in the. NET Framework are implemented with the WIN32 structured exception handling mechanism. For more information, see Structured exception Handling (c + +) and A Crash Course on the depths of Win32 structured Exception handling (for an in-depth study of WIN32 structured exception handling Urgent course).
Just learn C # that array, I know there is a thing called WPF, but always do not know what is the use of, recently a little enlightened (after all, the big homework. whining), windows Presentation Foundation (WPF) is a next-generation display system that generates a WINDOWS client application that brings a stunning visual experience to the user. contoso Healthcare Sample application that's shown in the following figure." > using WPF, you can create a wide range of standalone applications and browser-hosted applications. For everyone to just understand the , bloggers stick to a code to see:
Open the Window1.xaml and replace the original with the following code:
<window x:class= "Wpfapplication1.window1"
Xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
Title= "Window1" height= "width=" >
<StackPanel>
<stackpanel orientation= "Horizontal" >
<textblock text= "Input:"/>
<textbox name= "Tbinput" width= "100px"/>
<button name= "Btncalc" click= "Btncalc_click" > Averaging </Button>
</StackPanel>
<stackpanel orientation= "Horizontal" >
<textblock text= "average:"/>
<label name= "Lblresult" foreground= "Red" width= "100px" >abc</Label>
</StackPanel>
</StackPanel>
</Window>
To add logic to the Btncalc_click event, open Window1.xaml.cs and add:
private void Btncalc_click (object sender, RoutedEventArgs e)
{
string input = TbInput.Text.Trim ();
if (! String.IsNullOrEmpty (input))
{
string[] Rawdataset = input. Split (",". ToCharArray ());
if (rawdataset.length! = 5)
Return
Try
{
int i = 0;
Double sum = 0;
for (; i < rawdataset.length; i++)
Sum + = Double.Parse (Rawdataset[i]);
Lblresult.content = sum/i;
}
catch (Exception ex)
{
MessageBox.Show (ex. Message);
}
}
}
Run the program, enter five numbers in the text box, separated by a space or comma, and then click the Calculate Average button to display the results. This is as long as you create a new WPF program and then run through this code and know what WPF is about.
The XAML here is an XML-based markup language (for Android, XML), which declares the appearance of the program in declarative form.because XAML is XML-based, the UI that is written with it is combined into a nested element hierarchy called the element tree. The element tree provides a logical and intuitive way to create and manage the UI. For more information, see Trees in WPF. Also interesting is the code-behind in WPF, which I am also exploring, which interested readers can understand.
(6) "bottomless" C #