Tuesday, 13 August 2019

14


14:

DataContext Class: Replace SQL Connection

Table Class: Reflects all fields in the database table.

16


Solah:

Data Island should be place logically in Window.Resources, however, it can be created anywhere in the page. Data island ties the names on the screen with the namespace in code and will be used to code to access it.

Pandrah


Pandrah

If we save 12345 in a text file as a string then as the number will be saved as String and because Character is 1 byte long in C#.

Therefore, 12345 when stored in the text file, it will at least use 5 Bytes if space.

Whereas, if the number is stored binary file then the number will be stored in binary format.

(12345) ==> 0b 00110000 00111001 ==> 2 Bytes.


Tera: Tera Tera Saroor



Tera:

When LINQ is used with Non-Generic collections such as ArrayList, HashTable, etc, We have to use <cast> in to order to cast the Non-Generic Collection to Generic Collection.

LINQ is not very good with Non-Generics therefore, we use CAST to overcome.

Barrah


BARAH

In C#, Validation class needs to be added in the code that allow to to handle the error by registering an error handler.

Validation.AddErrorHandler(textBoxName, textBox_ValidationError); this method is called within MainWindow()

protected void textBox_ValidationError(object sender, ValidationErrorEventArgs error){
MessageBox.Show(string)error.Error.ErroContent);
}

When an error occurred, the messageBox will show from textBox_ValidationError method and it will notify the user.

In XAML, the error handling is done using Notification window, when an error occurred error notification window will show on the scree.

<TextBox.Text>
<Binding Path = "FieldName"
NotifyValidationError = "True">
</Binding>
</TextBox.Text>

Above, when the data input is invalid, error will be notified.

GYAARAH


GYAARAH:



There is no significant difference between the performance of lambda and non-lambda LINQ queries.

In addition, after compilation, both LINQ and LAMBDA query results in the same file which is then executed at compile time.


Choosing between LINQ and LAMBDA is a personal preference.