Learn C# .NET from the Best Tutors
Search in
Lesson Posted on 03/09/2019 Learn C# .NET
Logeswaran
I am working professional, tutor on my specialised area(Python for Automation & Development). I have...
facebook = {
'jose': {
'name': 'jose', 'age': 33,
'hobby': ['cricket', 'python'], # cricket,football
'mobile': 1111111111, 'email': 'joset@gmail.com',
'contacts':[6666666666,3333333333,4444444444],
'pages': {
'python': {'sudha', 'priyanka'},
'BusinessMantra': {'sudha', 'oviya'}
}
},
'sudha': {
'name': 'sudha', 'age': 32, 'hobby': ['Khabadi', 'Movies', chess'],
'mobile': 2222222222, 'email': 'sudha.ram@gmail.com',
'contacts':[5555555555],
'pages':{
'python':{'sudha', 'lok'},
'furnitures': {'chris', 'priyanka'}
}
},
'lok': {
'name': 'lok', 'age': 26, 'hobby': ['python','football'],
'mobile': 3333333333, 'email': 'lok123@gmail.com',
'contacts':[3333333333,7777777777],
'pages':{
'python':{'chris', 'priyanka', 'jose'}
}
},
'priyanka': {
'name': 'priyanka', 'age': 26, 'hobby': 'football',
'mobile': 4444444444, 'email': 'pravi@gmail.com',
'contacts':[5555555555,3333333333,4444444444],
'pages':{'python':{'chris', 'jose'}}
},
'chris': {
'name': 'chris', 'age': 35, 'hobby': 'football',
'mobile': 5555555555, 'email': 'christopher.e@gmail.com',
'contacts':[6666666666,3333333333,4444444444]}
}
read less
Answered on 21/07/2019 Learn C# .NET
I want to join the coaching for net in education subject at Kanpur (Gurdev palace ). Please suggest me best coaching for net.
read lessRaman
IT Professional Trainer with 12 Years of Experience in IT Industry
Answered on 05/02/2020 Learn C# .NET
Thincor Academy
Learn C# .NET from the Best Tutors
Lesson Posted on 25/09/2018 Learn C# .NET
Why a function in C# requires "Return type"??
Raga Deepthi Gade
I am an experienced .NET professional with over 8+ years of experience in teaching C , C# , Asp.Net ,...
- Basically , a Method is a piece of code used for the re-usability purpose.
- Method is of 2 types Function and Procedure
- Function is a method which returns a value to the calling place
Procedure is a method which returns nothing to the calling place.
Procedure syntax:
<procedurename>(<params>[optional])
{
//code
}
Procedure samples:
Display()
{
Console.WriteLine("Procedure returns no value");
}
Add(int a, int b)
{
Console.WriteLine("Sum : "+(a+b));
}
Hence, a function always returns a value or void to the calling place and a procedure returns nothing.
C# do not support Procedure. So functions in C# should be defined with the return type.
read less
Lesson Posted on 29/06/2018 Learn C# .NET
What are various validator in ASP.NET 2.0 and features common in all validation control in ASP.NET
Suprio D.
Corporate technology consultant. Having training experience in dot-net platform(3.5 linq,and wcf framework,web...
Control to validate an error message. Are common feature in all the controls.
Various validators are requiredfeild validator ,compare validator ,regular expression validator,custom validator,range validator and validation summary.
1. Required field validator asks for the missing field in server side controls like textboxes dropdowlistot list box or checkboxlist and tells to populate in the form of error message.
2. Compare validator asks for two textboxes or familiar controls to have the exact match of the data types ore expressions.
3. Regular expression validator asks for correct format of email passwords and phone numbers or website address.
4. The custom validator does the same what regular expression validator does additionally it can customize its own features of validation by language coding means.
5.Validation summary. Display list of error messages in the form of bullet list on the top of the registration page etc.
6. Range validator checks whether the data types entered is falling in the correct ranges. Example values between two integer or dates or strings or float currencies etc..
Lesson Posted on 28/06/2018 Learn C# .NET
What are Various Types of Exception in C#
Suprio D.
Corporate technology consultant. Having training experience in dot-net platform(3.5 linq,and wcf framework,web...
ArgumentException occurs due to the appearance of invalid argument types
argument null exception is due to null argument appearances. and out of range is when argument is defined which exceeds within its own bound levels.
null reference exception is when referencing an object you come across null character.
IndexOutOfRangeException is when the index is defined beyond the actual bound levels. like in arrays. carrying integers of other characters.
sql exception is when mismatch happens between the number of rows or columns or irrelevant data types happens when client-side access the server side. in the database.
InvalidCastexception happens when the wrong type of casting happens between to data types for example between string and integer.
StackOverflowException happens when stacks try to acquire values beyond its own bound levels preassigned.
read less
Learn C# .NET from the Best Tutors
Lesson Posted on 30/03/2018 Learn C# .NET
Raga Deepthi Gade
I am an experienced .NET professional with over 8+ years of experience in teaching C , C# , Asp.Net ,...
foreach is a looping statement :
Advantages:
Syntax:
foreach(<datatype of collection / array> <variablename> <in> <collection/array>)
{
code....
}
Example:
foreach(string courseName in coursesList)
{
code....
}
Working style of foreach loop:
Example 1: In the below example, we'll see how to iterate a group of int type array elements using foreach loop.
Example 2: In the below example, we'll see how to iterate a group of values in a collection.
NOTE : in .NET we've different types of collections. For example we took "List" a generic collection
read less
Lesson Posted on 03/01/2018 Learn C# .NET
Samir Bhogayta
Session Objectives:
Discuss the following:
Drawbacks of traditional programming
Need for Object: Oriented approach
Object: Oriented techniques
Discuss Object: Oriented Concepts
Need for OOP:
The drawbacks of Traditional Programming approach are:
Benefits of Object Oriented Programming approach are:
Objects:
Classes:
Abstraction:
Inheritance:
Data Encapsulation:
Polymorphism:
read less
Lesson Posted on 23/11/2017 Learn C# .NET
Pro Developer Program Syllabus
DeCode Classes
DeCode Classes is based at Pune, India. DeCode is an outcome of joint and co-operative venture of...
Learn C# .NET from the Best Tutors
Lesson Posted on 12/10/2017 Learn C# .NET
Object Initializers And Collection Initializers: A Syntactic Sugar In C# 3.0
Debendra Prasad Dash
4+ years of experiance in software industry.Nearly 1 year in software trainer.
i. Introduction:
Object initializers and Collection initializers are part of C# 3.0.These two concepts add a flexibility, readability, and maintainability in C#. As we are C# developers, we should know how and in which situations we can use these two concepts and inprove our programming logic. Before going deep, dive into object and collection initializers. We will check what are these Syntactic Sugars.
ii. Syntactic sugar in programming:
Syntactic sugar, or syntax sugar, is considered as a "shortcut" provided by the language, which reduces the amount of code that must be written in a particular situation.
Syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use: things can be expressed more clearly, more concisely, or in an alternative style that some may prefer.
The main benifits of using syntatic sugar in programming are:
Avoid lot of keystrokes,The efficiency of software programs is sometimes measured by the number of keystrokes it requires to write a specific function.
Easy to readable and maintainable.
Time saving approach.
Let's see an example of how we can use syntactic sugar in our program. Let's consider an example of normal IF-ELSE conditional statement:
class Program
{
static void Main(string[] args)
{
int x = 20, y = 10;
if (x>y)
{
Console.WriteLine(x);
}
else
{
Console.WriteLine(y);
}
Console.ReadLine();
}
Now, let's use Ternary operators and see how much key strokes we can prevent using Ternary operator.
class Program
{
static void Main(string[] args)
{
int x = 20, y = 10;
var result = x > y ? x : y;
Console.WriteLine(result);
Console.ReadLine();
}
So, in this way, we can say that by using ternary operator, we can achive syntactic sugar in our programming. Now, let's come to our main topic about Object Initialization and Collection Initialization.
So in programming, initialization is the assignment of an initial value for a data object or variable.
iii. Object Initializers:
Before going toward object initializers, let us see how we are initialising a object in C# 2.0:
public class Employee
{
public string Name { get; set; }
public int Id { get; set; }
public string Department { get; set; }
public int salary { get; set; }
}
class Program
{
static void Main(string[] args)
{
Employee emp=new Employee();
emp.Name = "Kumar";
emp.Department = "IT";
emp.Id = 101;
emp.salary = 80000;
Console.ReadLine();
}
}
Let's see how we can do that using object initializer in C# 3.0.
Write the same program using Object Initializer:
class Program
{
static void Main(string[] args)
{
Employee emp = new Employee {Name = "Kisan",Id = 55,Department = "IT",salary = 20000};
}
}
It seems that we have saved a lot of Key strokes using this Object Initializer. So, this is also considered as a "Syntactic Sugar".
iv. Collection Initializers:
Collection Initializers are used to initialize a collection in a planned and advance manner to avoid lot of Key strokes:
namespace syntax_sugar
{
public class Employee
{
public string Name { get; set; }
public int Id { get; set; }
public string Department { get; set; }
public int salary { get; set; }
}
class Program
{
static void Main(string[] args)
{
List liemp=new List();
Employee emp = new Employee();
emp.Name = "Kumar";
emp.Department = "IT";
emp.Id = 101;
emp.salary = 80000;
liemp.Add(emp); //one object is added in the list
Employee emp1 = new Employee();
emp1.Name = "Abdul";
emp1.Department = "IT";
emp1.Id = 1010;
emp1.salary = 80000;
liemp.Add(emp1); //Second object is added in the List
}
}
Let's see how we can improve our coading quality using collection Initializers. Consider the following program for reference:
static void Main(string[] args)
{
List liemp = new List
{
new Employee {Name = "Kumar",Id = 101,Department = "IT",salary = 80000},
new Employee {Name = "Abdul",Id = 1010,Department = "IT",salary = 80000}
};
}
Conclusion:
Here, our main intention is to make you aware about Collection Initialization and Object Initiallization which are two important concepts discovered in C# 3.0, and let you know how these two important concepts are considered as syntactic sugar in progromming.
Hope you liked this article. If you have any doubts and suggestation, please do comment so that I can update.read less
UrbanPro.com helps you to connect with the best C# .NET in India. Post Your Requirement today and get connected.
Ask a Question
The best tutors for C# .NET Classes are on UrbanPro
The best Tutors for C# .NET Classes are on UrbanPro
Book a Free Demo