1 | #Region "Microsoft.VisualBasic::8bd6e5a320bd2cb0a7b28d201bbb7b26, Microsoft.VisualBasic.Core\Extensions\Collection\AnonymousTypeHelper.vb" |
2 | |
3 | ' Author: |
4 | ' |
5 | ' asuka (amethyst.asuka@gcmodeller.org) |
6 | ' xie (genetics@smrucc.org) |
7 | ' xieguigang (xie.guigang@live.com) |
8 | ' |
9 | ' Copyright (c) 2018 GPL3 Licensed |
10 | ' |
11 | ' |
12 | ' GNU GENERAL PUBLIC LICENSE (GPL3) |
13 | ' |
14 | ' |
15 | ' This program is free software: you can redistribute it and/or modify |
16 | ' it under the terms of the GNU General Public License as published by |
17 | ' the Free Software Foundation, either version 3 of the License, or |
18 | ' (at your option) any later version. |
19 | ' |
20 | ' This program is distributed in the hope that it will be useful, |
21 | ' but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | ' GNU General Public License for more details. |
24 | ' |
25 | ' You should have received a copy of the GNU General Public License |
26 | ' along with this program. If not, see <http://www.gnu.org/licenses/>. |
27 | |
28 | |
29 | |
30 | ' /********************************************************************************/ |
31 | |
32 | ' Summaries: |
33 | |
34 | ' Module AnonymousTypeHelper |
35 | ' |
36 | ' Function: (+2 Overloads) CopyTypeDef |
37 | ' |
38 | ' /********************************************************************************/ |
39 | |
40 | #End Region |
41 | |
42 | Imports System.Runtime.CompilerServices |
43 | Imports Microsoft.VisualBasic.Language |
44 | |
45 | Public Module AnonymousTypeHelper |
46 | |
47 | #Disable Warning |
48 | |
49 | ''' <summary> |
50 | ''' You can using this method to create a empty list for the specific type of anonymous type object. |
51 | ''' (使用这个方法获取得到匿名类型的列表数据集合对象) |
52 | ''' </summary> |
53 | ''' <typeparam name="TAnonymousType"></typeparam> |
54 | ''' <param name="typedef">The temp object which was created anonymous. |
55 | ''' (匿名对象的集合,这个是用来复制匿名类型的,虽然没有引用这个参数,但是却可以直接通过拓展来得到匿名类型生成列表对象) |
56 | ''' </param> |
57 | ''' <returns></returns> |
58 | ''' <remarks></remarks> |
59 | <Extension> Public Function CopyTypeDef(Of TAnonymousType As Class)(typedef As IEnumerable(Of TAnonymousType)) As List(Of TAnonymousType) |
60 | Return New List(Of TAnonymousType) |
61 | End Function |
62 | #Enable Warning |
63 | |
64 | ''' <summary> |
65 | ''' |
66 | ''' </summary> |
67 | ''' <typeparam name="TKey"></typeparam> |
68 | ''' <typeparam name="TValue"></typeparam> |
69 | ''' <param name="source">仅仅是起到类型复制的作用</param> |
70 | ''' <returns></returns> |
71 | <Extension> Public Function CopyTypeDef(Of TKey, TValue)(source As Dictionary(Of TKey, TValue)) As Dictionary(Of TKey, TValue) |
72 | Dim table As New Dictionary(Of TKey, TValue) |
73 | Return table |
74 | End Function |
75 | End Module |