What the meaning of " (!0) " in ILNumerics Library? [duplicate] - c#

This question already has answers here:
Why is !0 a type in Microsoft Intermediate Language (MSIL)?
(2 answers)
Closed 6 years ago.
What the meaning of " (!0) " in ILNumerics just like this
return (!0)ILMathInternal.exp(this.m_mu);
and like this,
return 0.5 + (!0)ILMathInternal.log(this.m_sigma) + this.m_mu + (!0)ILMathInternal.log(ILMathInternal.sqrt(2.0 * ILMathInternal.pi));
Why we use this kind of expression---"(!0)" ?

(!0) has no meaning, it is not valid C#
If I had to guess, which I do, I suspect the (!0) is how a decompiler has chosen to represent some IL code that has no C# representation.

Related

Is there a simpler way to code the following C# sentence [duplicate]

This question already has answers here:
How to elegantly check if a number is within a range?
(33 answers)
Is there a "between" function in C#?
(18 answers)
C# Variable Name "_" (underscore) only
(5 answers)
Closed 4 months ago.
The community reviewed whether to reopen this question 4 months ago and left it closed:
Original close reason(s) were not resolved
Is there a simpler or alternate way to code the following C# sentence?
if (iValue >= 4 && iValue <= 10) {... other code ...}
Do I need to repeat the iValue twice?
I have seen a structure similar to _ = ...some code... but I am not familiar with that leading underscore?
With C#9 you can use:
if(iValue is >= 4 and <= 10)
{
Console.WriteLine("in range");
}

c# Compact framework Math.Round up problem [duplicate]

This question already has answers here:
Why does Math.Round(2.5) return 2 instead of 3?
(15 answers)
Closed 2 years ago.
I am using VS2008 c# , windows mobile 6.5, so I have to use the .Net Compact Framework, the problem is:
When Math.Round(66.05,1) the result is 66 when the correc value should be 66.1
what can I do ? how should I use the round() function
Thanks
You should use the overloaded static Math.Round method which takes two arguments:
decimal x = Math.Round(2.5555, 2); // x == 2.56
You can read more here.
The issue with this is that the Mathf.Round method by default use "ToEven convention" There is an example using MidpointRounding.AwayFromZero that will give you the result you expect

VB to C# in InStrRev [duplicate]

This question already has answers here:
C# equivalent to InStrRev
(3 answers)
Closed 7 years ago.
I need to rewrite
Microsoft.VisualBasic.Strings.Mid(pReturn, (InstrRev(pReturn, ".") + 1), (pReturn).Length)).Length > 4
to C# but can't find a concise solution for InstrRev.
How can I convert this line?
String.LastIndexOf would be the equivalent.

C# Equivalent to VB6 Chr(number) [duplicate]

This question already has answers here:
What's the equivalent of VB's Asc() and Chr() functions in C#?
(12 answers)
Closed 8 years ago.
I have this code:
Dim sCenter As String
sCenter = Chr(27) + Chr(97) + Chr(1)
And I'm trying to convert to a C# code. Online converters always fail to convert... :(
So, what is the C# equivalente of Chr(number)?
Maybe Char.ConvertFromUtf32(10);
Feel like taking risk to answer but how about?
string sCenter;
sCenter = "" + (char)27 + (char)97 + (char)1;
Thanks to James Curran's comment about char integral addition. As his suggested, I added meaningless "" with char to get string + char which uses .ToString() with String.Concat method at background.

Simple tab question [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Programmatically using tab character in .NET?
Is there an equivalent value for "\t" as System.Environment.NewLine is to "\r\n"?
I am looking for something built into the framework. I know it is a trivial question, but I couldn't find anything during my googling session. I am hoping/wishing this exists.
Thanks!
Newline varies from platform to platform but tab does no, so it should be safe to use "\t" . I guess you could create a const and use it for sanity.

Categories