C# Anonymous Types Tutorial with Examples
Today, We want to share with you C# Anonymous Types Tutorial with Examples.
In this post we will show you Anonymous Types In C#, hear for Example for Anonymous Types of C# .NET we will give you demo and example for implement.
In this post, we will learn about C Sharp Var data type and Anonymous Type with an example.
Anonymous Types In C#
In this post,we will learn about Anonymous Types In C# with an example.
Now in this post, I will explain about Anonymous Types In C# with appropriate example.
Anonymous types are use to create new type without defining them. It enable you to define read only properties into a single object without having to define type explicitly. Type is generated by the compiler and it is accessible only for the current block of code in the program.
You can create anonymous types by using “new” keyword with the object initializer. The Compiler creats a name for each anonymous type.
[php]
static void Main(string[] args)
{
var EmployeeData = new
{
FirtsName = “Jaydeep”,
LastName = “Gondaliya”
};
Console.WriteLine(“First Name : ” + EmployeeData.FirtsName + “\nLast Name : ” + EmployeeData.LastName);
Console.ReadLine();
}
[/php]
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about C# Anonymous Types.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.