初始化项目

This commit is contained in:
2025-12-11 14:22:51 +08:00
commit 4243e3e4d8
919 changed files with 840529 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary
Imports Processform.DeviceModel
Public Class DeepCopyHelper
Public Shared Function DeepCopy(Of T)(ByVal obj As T) As T
If Not GetType(T).IsSerializable Then
Throw New ArgumentException("The type must be serializable.", NameOf(obj))
End If
If obj Is Nothing Then
Return Nothing
End If
Dim formatter As BinaryFormatter = New BinaryFormatter()
Using stream As MemoryStream = New MemoryStream()
formatter.Serialize(stream, obj)
stream.Seek(0, SeekOrigin.Begin)
Return CType(formatter.Deserialize(stream), T)
End Using
End Function
Public Shared Function DictionaryCopy(dic As Dictionary(Of String, DeviceModel)) As Dictionary(Of String, DeviceModel)
Dim resultdic As New Dictionary(Of String, DeviceModel)
For Each index In dic
resultdic.Add(index.Key, index.Value)
Next
Return resultdic
End Function
End Class