Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

variable size in memory c#

Unmanaged object:
Marshal.SizeOf(object yourObj);
//-----------------------------------------------------
Value Types:
sizeof(object val);
  //-----------------------------------------------------
calculate how much memory an object take c#

long size = 0;
object o = new object();
using (Stream s = new MemoryStream()) {
    BinaryFormatter formatter = new BinaryFormatter();
    formatter.Serialize(s, o);
    size = s.Length;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how read excel data in c# 
Csharp :: to list c# 
Csharp :: conditional if statement c# programming 
Csharp :: array declaration in c# 
Csharp :: get enum value c# 
Csharp :: nexo price 
Csharp :: element click intercepted exception in selenium C# 
Csharp :: C# Switch and case 
Csharp :: c# convert string to uri 
Csharp :: c# wpf row definition height * in code 
Csharp :: convert object to iqueryable in c# 
Csharp :: c# get date without time 
Csharp :: c# max function 
Csharp :: change line color in c# 
Csharp :: how to add data in list in c# 
Csharp :: how to get mouse position c# 
Csharp :: change size of button c# 
Csharp :: Code to disable Debug.log 
Csharp :: onmousedown not working unity 
Csharp :: entity framework with query C# 
Csharp :: c# xmldocument from file 
Csharp :: how to set a tag in asp net razor view stackoverflow 
Csharp :: how to check type in c# 
Csharp :: dinktopdf page break 
Csharp :: Convert DataTable to excel file c# using epplus 
Csharp :: C# top down view player movement script 
Csharp :: c# selenium xunit testing 
Csharp :: Advertisement code for unity 
Csharp :: minimum of three numbers 
Csharp :: unity audiosource play 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =