当前位置:网站首页>[C language] named type and anonymous type
[C language] named type and anonymous type
2022-07-26 10:22:00 【Wenbus】
Anonymous types , Often used for LINQ Among the results of the query .
Type of name , Its object creation expression consists of three parts :new keyword , Class name or constructor , Object initialization statement . The object initialization statement is in a set of braces , Contains a comma separated list of member initializations .
Anonymous types , Its object creation expression uses the same form , But there is no class name and constructor .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Anonymous types
{
class Program
{
static void Main(string[] args)
{
// Object initialization statement of anonymous type
var Student = new { name = " Zhang San ", age = 16 };
Console.WriteLine(" full name :{0} , Age :{1}", Student.name, Student.age);
Console.Read();
}
}
}
If the compiler encounters another parameter with the same name , The same inference type , Anonymous types in the same order , It will reuse this type , And directly create a new instance , No new anonymous types will be created .
边栏推荐
- 数通基础-Telnet远程管理设备
- Study notes of the third week of sophomore year
- Okaleido ecological core equity Oka, all in fusion mining mode
- Network related journals and conferences in CS
- El table implements adding / deleting rows, and a parameter changes accordingly
- Data communication foundation telnet remote management equipment
- Uniapp common error [wxml file compilation error]./pages/home/home Wxml and using MySQL front provided by phpstudy to establish an independent MySQL database and a detailed tutorial for independent da
- The fourth week of summer vacation
- Use spiel expressions in custom annotations to dynamically obtain method parameters or execute methods
- [qualcomm][network] QTI service analysis
猜你喜欢

【Halcon视觉】形态学膨胀

Deduct daily question 838 of a certain day

Flask框架初学-04-flask蓝图及代码抽离

3.1 leetcode daily question 6

议程速递 | 7月27日分论坛议程一览
![[Qualcomm][Network] qti服务分析](/img/76/49054ff8c7215eca98cc479ab1d986.png)
[Qualcomm][Network] qti服务分析
![Uniapp common error [wxml file compilation error]./pages/home/home Wxml and using MySQL front provided by phpstudy to establish an independent MySQL database and a detailed tutorial for independent da](/img/21/5dceab9815b503f0b62d26a430d7eb.png)
Uniapp common error [wxml file compilation error]./pages/home/home Wxml and using MySQL front provided by phpstudy to establish an independent MySQL database and a detailed tutorial for independent da

Introduction to latex, EPS picture bounding box

El table implements adding / deleting rows, and a parameter changes accordingly

Cause: could't make a guess for solution
随机推荐
MLX90640 红外热成像仪测温传感器模块开发笔记(六)
Li Kou daily question 917
Using undertow, Nacos offline logout delay after service stop
Server memory failure prediction can actually do this!
Data communication foundation TCPIP reference model
Distributed network communication framework: how to publish local services into RPC services
面试第二家公司的面试题及答案(二)
Solution of inputting whole line string after inputting integer
[Qualcomm][Network] qti服务分析
关于模板函数声明与定义的问题[通俗易懂]
Learning about tensor (III)
【Halcon视觉】算子的结构
Formwork (III)
Strange Towers of Hanoi|汉诺塔4柱问题
Study notes at the end of summer vacation
Nacos custom service change subscription
Network related journals and conferences in CS
数通基础-二层交换原理
The CLOB field cannot be converted when querying Damon database
数通基础-Telnet远程管理设备