I need to know how to get a string's length in pixels in C# Unity3D.    string msg = ""You Must be from South Carolina!";   How do I get the above message string length in Pixels?.
122391
I have a string like this:  string s = "This is my string";   I am creating a Telerik report and I need to define a textbox that is the width of my string. However the size property needs to be set to a Unit (Pixel, Point, Inch, etc).  How can I convert my string length into, say a Pixel so I can set the width?  EDIT:  I have tried getting a reference to the graphics object, but this is done in a class that inherits from Telerik.Reporting.Report.
1141
I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object? const myObject = new Object(); myObject[&quot;firstname&quot;] = &quot;Gareth&quot;; myObject[&quot;lastname&quot;] = &quot;Simpson&quot;; myObject[&quot;age&quot;] = 21;
53171
Formatting numbers on a VF page, but I do a bunch of processing the Apex Class, so I would rather return the formatted String value from the controller.   I am doing something like this, but I just want the second number to appear as "(1500)" rather "-1500"  Getting lost in the Message Format docs, so hoping someone can guide me in the right direction...  List&lt;String&gt; args = new String[]{'0','number','###,###,###'}; system.debug('Positive' + String.format(  ( (1000) - (500.50)  ).round().format(), args) ); system.debug('Negative' + String.format(  ( (-1000) - (500.50)  ).round().format(), args) );
30627
In C# the Main class has string[] args parameter.  What is that for and where does it get used?
56236
Shouldn't this be a pretty straightforward operation? However, I see there's neither a size() nor length() method.
46323
A Java version of this question was just answered, and, well, I don't know how to do this in .net.   So how do you calculate the display width of a string in C# / .net?
66573
I know that in JavaScript, creating a for loop like this: for(int i = 0; i &lt; arr.length; i++) is costly as it computes the array length each time. Is this behavior costly in c# for lists and arrays as well. Or at compile-time is it optimized?  Also what about other languages such as Java, how is this handled?
113003
We are using the CString class throughout most of our code. However sometimes we need to convert to a char *. at the moment we have been doing this using variable.GetBuffer(0) and this seems to work ( this mainly happens when passing the Csting into a function where the function requires a char *). The function accepts this and we keep going.  However we have lately become worried about how this works, and whether there is a better way to do it.  The way i understand it to work is it passes a char pointer into the function that points at the first character in the CString and all works well.  I Guess we are just worried about memory leaks or any unforseen circumstances where this might not be a good idea.
39676
How do I convert a string to a byte[] in .NET (C#) without manually specifying a specific encoding?  I'm going to encrypt the string. I can encrypt it without converting, but I'd still like to know why encoding comes to play here.  Also, why should encoding even be taken into consideration? Can't I simply get what bytes the string has been stored in? Why is there a dependency on character encodings?
114098
I'm trying to write some C# code that calls a method from an unmanaged DLL.  The prototype for the function in the dll is:  extern "C" __declspec(dllexport) char *foo(void);   In C#, I first used:  [DllImport(_dllLocation)] public static extern string foo();   It seems to work on the surface, but I'm getting memory corruption errors during runtime. I think I'm pointing to memory that happens to be correct, but has already been freed.  I tried using a PInvoke code gen utility called "P/Invoke Interop Assistant".  It gave me the output:  [System.Runtime.InteropServices.DLLImportAttribute(_dllLocation, EntryPoint = "foo")] public static extern System.IntPtr foo();   Is this correct? If so, how do I convert this IntPtr to a string in C#?
102716
How do I manipulate images at the pixel level in C#?  I need to be able to read/modify each bitmap pixel RGB values separately.   A code sample would be appreciated.
31820
If I want to construct a std::string with a line like:  std::string my_string("a\0b");   Where i want to have three characters in the resulting string (a, null, b), I only get one.  What is the proper syntax?
95490
Why am I getting an out of memory exception?  So this dies in C# on the first time through:  splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat));   Where splitBitmaps is a List&lt;BitMap&gt; BUT this works in VB for at least 4 iterations:  arlSplitBitmaps.Add(Image.Clone(rectDimensions, Image.PixelFormat))  Where arlSplitBitmaps is a simple array list.  (And yes I've tried arraylist in c#)  This is the fullsection:  for (Int32 splitIndex = 0; splitIndex &lt;= numberOfResultingImages - 1; splitIndex++) {    Rectangle rectDimensions;    if (splitIndex &lt; numberOfResultingImages - 1)    {     rectDimensions = new Rectangle(splitImageWidth * splitIndex, 0,        splitImageWidth, splitImageHeight);    }    else    {     rectDimensions = new Rectangle(splitImageWidth * splitIndex, 0,       sourceImageWidth - (splitImageWidth * splitIndex), splitImageHeight);    }     splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat));    }   neededImage is a Bitmap by the way.   I can't find any useful answers on the intarweb, especially not why it works just fine in VB.  Update:  I actually found a reason (sort of) for this working but forgot to post it.  It has to do with converting the image to a bitmap instead of just trying to clone the raw image if I remember.
23076
How do I go from this string: "ThisIsMyCapsDelimitedString"  ...to this string: "This Is My Caps Delimited String"  Fewest lines of code in VB.net is preferred but C# is also welcome.  Cheers!
38175
For example: sizeof(char*) returns 4.  As does int*, long long*, everything that I've tried.  Are there any exceptions to this?
38617
My AppleScript app needs to get color of pixel in coordinates 123, 456 in screen.
81643
What is the purpose of the LongLength property for arrays in .Net.  Using a standard integer for length, you could accommodate up to 2 billion indices.  Are there really people using .Net to maintain a single array with more the 2 billion elements.  Even if each element was a single byte, that would still be 2 GB of data.   Is it feasible to use such a large array in .Net?