Vanara.Core 4.2.0

Prefix Reserved
dotnet add package Vanara.Core --version 4.2.0
                    
NuGet\Install-Package Vanara.Core -Version 4.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Vanara.Core" Version="4.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vanara.Core" Version="4.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Vanara.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Vanara.Core --version 4.2.0
                    
#r "nuget: Vanara.Core, 4.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Vanara.Core@4.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Vanara.Core&version=4.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Vanara.Core&version=4.2.0
                    
Install as a Cake Tool

Vanara

Vanara.Core NuGet Package

Version Build status

This library includes shared methods, structures and constants for use throughout the Vanara assemblies. Think of it as windows.h with some useful extensions. It includes:

  • Extension methods for working with enumerated types (enum), FILETIME, and method and property extractions via reflection
  • Extension and helper methods to marshaling structures arrays and strings
  • SafeHandle based classes for working with memory allocated via CoTaskMem, HGlobal, or Local calls that handles packing and extracting arrays, structures and raw memory
  • Safe pinning of objects in memory
  • Memory stream based on marshaled memory

What is Vanara?

Vanara is a community project that contains various .NET assemblies which have P/Invoke functions, interfaces, enums and structures from Windows libraries. Each assembly is associated with one or a few tightly related libraries.

Issues?

First check if it's already fixed by trying the MyGet build. If you're still running into problems, file an issue.

Included in Vanara.Core

Classes Structures Enumerations Interfaces
AddAsCtorAttribute AddAsMemberAttribute AdjustAutoMethodNamePatternAttribute AlignedMemory AppendedStringAttribute ArrayAttribute AutoHandleAttribute AutoSafeHandleAttribute BeginEndEventContext BitFieldAttribute BitHelper ByteSizeFormatter CloseHandleFunc ComConnectionPoint ComEnumString ComReleaser ComReleaserFactory ComStream ComTypeExtensions ConstantConversionExtensions CorrespondingTypeAttribute CoTaskMemoryMethods DeferAutoMethodToAttribute EnumerableEqualityComparer EnumExtensions EventedList FileTimeExtensions FixedStringAttribute Formatter FormatterComposer GenericSafeHandle GenericVirtualReadOnlyDictionary GuidToStringMarshaler HexDumpHelpers HGlobalMemoryMethods History IArrayStructExtensions IArrayStructMarshaler IgnoreAttribute InteropExtensions IntPtrConverter IOExtensions LibHelper LinqHelpers ListChangedEventArgs MarshaledAlternativeAttribute MarshaledAttribute Marshaler MarshalerOptions MarshalException MarshalFieldAs MarshalingStream Matrix Matrix MemoryMethodsBase NativeMemoryEnumerator NativeMemoryStream PinnedObject ReflectionExtensions ReflectionExtensions SafeAllocatedMemoryHandle SafeAllocatedMemoryHandleBase SafeByteArray SafeCoTaskMemHandle SafeCoTaskMemString SafeCoTaskMemStruct SafeGuidPtr SafeHANDLE SafeHGlobalHandle SafeHGlobalStruct SafeLPSTR SafeLPTSTR SafeLPWSTR SafeMemoryHandle SafeMemoryHandleExt SafeMemoryPool SafeMemString SafeMemStruct SizeDefAttribute SizeFieldNameAttribute SizeFieldNameAttributeExt SizeOfAttribute SpanAction SparseArray StringHelper StructPtrAttribute SuppressAutoGenAttribute TryGetDelegate TryGetValueDelegate UnionHelper UntypedNativeMemoryEnumerator VanaraCustomMarshaler VanaraMarshaler VanaraMarshalerAttribute VirtualDictionary VirtualList VirtualListMethodCarrier VirtualReadOnlyDictionary VirtualReadOnlyList AnySizeStructFieldArray AnySizeStructUnmanagedFieldArray ArrayPointer BitField BOOL BOOLEAN EnumFlagIndexer GuidPtr IUnknownPointer LPCSTRArrayPointer LPCTSTRArrayPointer LPCWSTRArrayPointer ManagedArrayPointer ManagedStructPointer RefEnumerator SizeT StrPtrAnsi StrPtrAuto StrPtrUni StructPointer time_t ArrayLayout Bitness CorrespondingAction FileAttributeConstant FileOpConstant FilePermissionConstant LayoutModel SizingMethod StringEncoding StringListPackMethod IArrayStruct IHandle IHistory IMemoryMethods ISafeMemoryHandle ISafeMemoryHandleBase ISafeMemoryHandleFactory ISimpleMemoryMethods ISupportIndexer IVanaraMarshaler IVirtualListMethods IVirtualReadOnlyListMethods
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (134)

Showing the top 5 NuGet packages that depend on Vanara.Core:

Package Downloads
Vanara.PInvoke.Shared

Shared methods, structures and constants for use throughout the Vanara.PInvoke assemblies. Includes: * IEnumerable helpers for COM enumerations * Custom marshaler for CoTaskMem pointers * Enhanced error results classes for HRESULT, Win32Error and NTStatus * Standard windows.h macros (e.g. HIWORD, MAKELONG, etc.) * Overlapped method wrapper * Resource ID holder * Shared structures and enums (see release notes)

Vanara.PInvoke.Kernel32

PInvoke API (methods, structures and constants) imported from Windows Kernel32.dll.

Vanara.PInvoke.Cryptography

PInvoke API (methods, structures and constants) imported from Windows crypt32.dll, bcrypt.dll, ncrypt.dll, tokenbinding.dll, cryptnet.dll, cryptdlg.dll and cryptui.dll.

Vanara.PInvoke.Security

PInvoke API (methods, structures and constants) imported from Windows AdvApi32.dll, Authz.dll, sspicli.dll, schannel.dll, tdh.dll and Secur32.dll.

Vanara.PInvoke.Gdi32

PInvoke API (methods, structures and constants) imported from Windows Gdi32.dll

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on Vanara.Core:

Repository Stars
omeryanar/FileExplorer
Windows File Explorer alternative with tab browsing
zhupingqi/RuiJi.Net
crawler framework, distributed crawler extractor
zqhong/RyzenTuner
A tool that supports adjusting the power limit of Ryzen mobile processors and the QoS level and priority of Windows processes
Version Downloads Last Updated
4.2.0 2,942 8/25/2025
4.1.6 51,952 6/20/2025
4.1.5 1,860 6/20/2025
4.1.4 21,508 6/7/2025
4.1.3 64,313 4/24/2025
4.1.2 13,003 4/16/2025
4.1.1 60,628 3/7/2025
4.1.0 3,140 3/7/2025 4.1.0 is deprecated because it has critical bugs.
4.0.6 17,798 2/24/2025
4.0.5 14,365 2/8/2025
4.0.4 203,146 9/13/2024
4.0.3 133,335 8/5/2024
4.0.2 44,266 6/24/2024
4.0.1 117,489 4/30/2024
4.0.0 34,668 3/29/2024
4.0.0-beta2 4,989 1/22/2024
4.0.0-beta 5,955 11/20/2023
3.4.17 188,519 10/18/2023
3.4.16 103,980 8/7/2023
3.4.15 249,507 5/18/2023
3.4.14 85,675 4/15/2023
3.4.13 105,774 2/4/2023
3.4.12 46,474 1/15/2023
3.4.11 98,549 11/15/2022
3.4.10 45,428 10/25/2022
3.4.9 43,348 10/3/2022
3.4.8 40,331 9/16/2022
3.4.7 37,487 9/3/2022
3.4.6 46,622 8/7/2022
3.4.5 42,356 7/17/2022
3.4.4 31,279 7/5/2022
3.4.3 49,145 6/14/2022
3.4.2 42,851 5/13/2022
3.4.1 32,390 5/5/2022
3.4.0 47,401 3/14/2022
3.3.15 109,898 12/27/2021
3.3.14 43,363 10/26/2021
3.3.13 32,619 9/30/2021
3.3.12 34,311 8/30/2021
3.3.11 43,147 7/22/2021
3.3.10 26,291 6/4/2021
3.3.9 19,400 5/7/2021
3.3.8 22,715 4/7/2021
3.3.7 18,671 3/24/2021
3.3.6 15,542 3/19/2021
3.3.5 19,396 3/1/2021
3.3.4 19,817 2/11/2021
3.3.3 23,786 2/3/2021
3.3.2 15,162 1/21/2021
3.3.1 18,331 1/20/2021
3.3.0 21,777 11/20/2020
3.2.21 13,702 11/13/2020
3.2.20 16,466 11/8/2020
3.2.19 22,898 10/23/2020
3.2.18 12,948 10/21/2020
3.2.17 25,655 9/20/2020
3.2.16 13,997 9/7/2020
3.2.15 12,894 8/30/2020
3.2.14 12,494 8/20/2020
3.2.13 13,279 7/27/2020
3.2.12 12,517 7/13/2020
3.2.11 13,489 6/28/2020
3.2.10 14,629 6/14/2020
3.2.9 13,292 6/3/2020
3.2.7 16,150 5/4/2020
3.2.6 12,472 4/21/2020
3.2.5 12,223 4/15/2020
3.2.4 12,063 4/12/2020
3.2.3 15,266 4/1/2020
3.2.2 11,134 3/24/2020
3.2.1 12,097 3/17/2020
3.2.0 11,772 2/27/2020
3.1.9 11,941 1/17/2020
3.1.8 11,517 1/13/2020
3.1.7 11,344 1/6/2020
3.1.6 11,238 12/12/2019
3.1.5 11,010 11/26/2019
3.1.4 10,794 11/25/2019
3.1.3 11,226 11/8/2019
3.1.2 10,499 11/4/2019
3.1.1 12,055 10/17/2019
3.1.0 10,170 10/3/2019
3.0.1 10,030 9/20/2019
3.0.0 12,190 8/27/2019
2.3.11 9,335 6/9/2019
2.3.10 6,969 6/5/2019
2.3.9 6,961 5/26/2019
2.3.8 6,883 5/13/2019
2.3.7 7,209 4/24/2019
2.3.6 8,089 4/17/2019
2.3.5 6,635 4/10/2019
2.3.4 6,522 3/9/2019
2.3.3 6,412 3/8/2019
2.3.2 6,294 2/28/2019
2.3.1 6,395 2/25/2019
2.3.0 6,207 2/22/2019
2.2.1 6,244 2/12/2019
2.2.0 6,226 2/1/2019
2.1.2 22,841 1/14/2019
2.1.0 7,407 12/15/2018
2.0.1 6,324 12/7/2018
2.0.0 6,609 11/28/2018
1.1.0 7,108 9/10/2018
1.0.18 6,045 8/10/2018
1.0.17 5,960 7/30/2018
1.0.16 6,593 6/29/2018
1.0.15 6,117 6/27/2018
1.0.14 5,940 6/8/2018
1.0.13 5,792 6/6/2018
1.0.12 6,265 4/5/2018
1.0.11 6,109 4/4/2018
1.0.10 5,923 3/27/2018
1.0.8 10,341 2/7/2018
1.0.7 5,976 1/27/2018
1.0.6 6,034 1/8/2018
1.0.5 5,778 12/28/2017
1.0.4 5,592 12/15/2017
1.0.3 4,858 12/8/2017
1.0.2 4,823 11/30/2017
1.0.1 5,176 11/28/2017
1.0.0 1,919 3/3/2017

Currently implements:

Classes
AddAsCtorAttribute, AddAsMemberAttribute, AdjustAutoMethodNamePatternAttribute, AlignedMemory<T>, AppendedStringAttribute, ArrayAttribute, AutoHandleAttribute, AutoSafeHandleAttribute, BeginEndEventContext, BitFieldAttribute<T>, BitHelper, ByteSizeFormatter, CloseHandleFunc, ComConnectionPoint, ComEnumString, ComReleaser<T>, ComReleaserFactory, ComStream, ComTypeExtensions, ConstantConversionExtensions, CorrespondingTypeAttribute, CoTaskMemoryMethods, DeferAutoMethodToAttribute, EnumerableEqualityComparer<T>, EnumExtensions, EventedList<T>, FileTimeExtensions, FixedStringAttribute, Formatter, FormatterComposer, GenericSafeHandle, GenericVirtualReadOnlyDictionary<T>, GuidToStringMarshaler, HexDumpHelpers, HGlobalMemoryMethods, History<T>, IArrayStructExtensions, IArrayStructMarshaler<T>, IgnoreAttribute, InteropExtensions, IntPtrConverter, IOExtensions, LibHelper, LinqHelpers, ListChangedEventArgs<T>, MarshaledAlternativeAttribute, MarshaledAttribute, Marshaler, MarshalerOptions, MarshalException, MarshalFieldAs, MarshalingStream, Matrix, Matrix<T>, MemoryMethodsBase, NativeMemoryEnumerator<T>, NativeMemoryStream, PinnedObject, ReflectionExtensions, ReflectionExtensions, SafeAllocatedMemoryHandle, SafeAllocatedMemoryHandleBase, SafeByteArray, SafeCoTaskMemHandle, SafeCoTaskMemString, SafeCoTaskMemStruct<T>, SafeGuidPtr, SafeHANDLE, SafeHGlobalHandle, SafeHGlobalStruct<T>, SafeLPSTR, SafeLPTSTR, SafeLPWSTR, SafeMemoryHandle<T>, SafeMemoryHandleExt<T>, SafeMemoryPool<T>, SafeMemString<T>, SafeMemStruct<T>, SizeDefAttribute, SizeFieldNameAttribute, SizeFieldNameAttributeExt, SizeOfAttribute, SpanAction, SparseArray<T>, StringHelper, StructPtrAttribute, SuppressAutoGenAttribute, TryGetDelegate, TryGetValueDelegate, UnionHelper, UntypedNativeMemoryEnumerator, VanaraCustomMarshaler<T>, VanaraMarshaler, VanaraMarshalerAttribute, VirtualDictionary<T>, VirtualList<T>, VirtualListMethodCarrier<T>, VirtualReadOnlyDictionary<T>, VirtualReadOnlyList<T>

Structures
AnySizeStructFieldArray<T>, AnySizeStructUnmanagedFieldArray<T>, ArrayPointer<T>, BitField<T>, BOOL, BOOLEAN, EnumFlagIndexer<T>, GuidPtr, IUnknownPointer<T>, LPCSTRArrayPointer, LPCTSTRArrayPointer, LPCWSTRArrayPointer, ManagedArrayPointer<T>, ManagedStructPointer<T>, RefEnumerator<T>, SizeT, StrPtrAnsi, StrPtrAuto, StrPtrUni, StructPointer<T>, time_t

Enumerations
ArrayLayout, Bitness, CorrespondingAction, FileAttributeConstant, FileOpConstant, FilePermissionConstant, LayoutModel, SizingMethod, StringEncoding, StringListPackMethod