什么" T"意味着在C#? [英] What does "T" mean in C#?

查看:172
本文介绍了什么" T"意味着在C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VB背景,我转换为C#为我的新工作。我也试图让在.NET总体较好。我已经看到了关键词T使用了大量的样品人岗。什么是T是指在C#中?例如:

I have a VB background and I'm converting to C# for my new job. I'm also trying to get better at .NET in general. I've seen the keyword "T" used a lot in samples people post. What does the "T" mean in C#? For example:

public class SomeBase<T> where T : SomeBase<T>, new()

这是什么 T 吗?我为什么要使用它?

What does T do? Why would I want to use it?

推荐答案

这是一个泛型类型的符号参数。它也可以同样是别的东西,例如:

It's a symbol for a generic type parameter. It could just as well be something else, for example:

public class SomeBase<GenericThingy> where GenericThingy : SomeBase<GenericThingy>, new()

只有T是使用,并鼓励通过微软默认的。

Only T is the default one used and encouraged by Microsoft.

这篇关于什么&QUOT; T&QUOT;意味着在C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆