---
title: "基于泛型的对象实例构造方法"
author: "carver"
date: "2010-12-16T10:23:44Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2010-12-16T10:23:44Z"
id: 844326
url: "https://carver.iteye.com/blog/844326"
---

如何创建泛型空对象实例：

default(T)

 

如何创建泛型对象实例：

Activator.CreateInstance(typeof(T))

 

如何创建动态泛型对象实例：

Type listType = typeof(List&lt;&gt;).MakeGenericType(new Type\[] { type });  
IList listObjs = Activator.CreateInstance(listType) as IList;