Sie sind auf Seite 1von 4

Sequitin, Camille Andrea B.

March 3, 2015

BSCE 4

Math Methods
Method Name

Description

Math.Abs

Absolute Value

Math.Acos

Angle (in radians) of the cosine value

Math.Asin

Angle (in radians) of the sine value

Math.Atan
Math.Atan2

Angle (in radians) of the tangent


value
Angle (in radians) of two tangent
values

Math.BigMul

Full Product of two 32-bit values

Math.Ceiling

Smallest integral value that is greater


than or equal to the specified decimal
number

Math.Cos

Cosine of the specified angle

Math.Cosh
Math.DivRem

Hyperbolic cosine of the specified


angle
Quotient of two integers and also
returns the remainder in an output
parameter

Math.E

Constant e value

Math.Equals

Determine if two values are equal

Math.Exp
Math.Floor
Math.IEEERemain
der
Math.Log
Math.Log10

Returns e raised to the specified


power
Largest integer less than or equal to
the specified decimal number
Remainder resulting from the division
of a specified number by another
specified number
Natural (base e) logarithm of a
specified number
Base 10 logarithm of a specified
number

Math.Max

Larger of two integers

Math.Min

Smaller of two integers

Example
Math.Abs(-1);
1
Math.Acos(.45);
1.10403.
Math.Asin(.56);
0.59438..
Math.Atan(.64);
0.56931..
Math.Atan2(.56, .64);
0.71882.
Math.BigMul(12345,6789);
83810205
Math.Ceiling(1.12);
2
Math.Cos(53);
-0.918283..
Math.Cosh(8);
1490.47916..
Math.DivRem(100, 3, out c);
33, 1
Math.E;
2.718281..
Math.Equals(1, 4);
False
Math.Exp(2);
7.38905.
Math.Floor(1.23);
1
Math.IEEERemainder(5.46,
4.34);
1.12
Math.Log(3, 5);
0.6826061
Math.Log10(2);
0.301029
Math.Max(5, 78);
78
Math.Min(5, 78);
5

Math.PI

PI value

Math.Pow

Number raised to the specified power

Math.ReferenceE
quals

Determines whether the specified


objects are the same

Math.Round

Rounds the value

Math.Sign

Value indicating the sign of a number

Math.Sin

Sine of the specified angle

Math.Sinh

Hyperbolic sine of the specified angle

Math.Sqrt

Square root of a specified number

Math.Tan

Tangent of the specified angle

Math.Tanh

Hyperbolic tangent of the specified


angle

Math.Truncate

Integral part of a specified number

Math.PI;
3.1415926.
Math.Pow(2, 4);
16
Math.ReferenceEquals(100, 56);
False
Math.Round(.78);
1
Math.Sign(-.89);
-1
Math.Sin(87);
-.0.8218178
Math.Sinh(57);
2.842859.
Math.Sqrt(144);
12
Math.Tan(45);
1.619775
Math.Tanh(65);
1
Math.Truncate(88.8);
88

Sample Programs
Program 1:

Program 2:
using System;

using System;

class Program1
{
static void Main()
{
long c;

class Program1
{
static void Main()
{
double x = Math.Truncate(88.8);

long x = Math.DivRem(100, 3, out c);

Console.WriteLine(x);

Console.WriteLine("{0}, {1}", x, c);

Console.Read();
}

Console.Read();

Output:

88

Output:

33, 1

String Methods
Method Name
String.Compare

String.CompareOr
dinal

String.Concat

String.Copy

String.Equals

String.Format
String.Intern
String.IsInterned
String.InNullorEmp
ty
String.IsNullOrWhi
teSpace
String.Join
String.ReferenceE
quals

Description
Compares two
specified String objects and returns
an integer that indicates their
relative position in the sort order
Compares two
specified String objects by
evaluating the numeric values of the
corresponding Char objects in each
string
Creates the string representation of
a specified object
Creates a new instance
of String with the same value as a
specified String
Determines whether this instance
and another specified String object
have the same value
Replaces one or more format items
in a specified string with the string
representation of a specified object
Retrieves the system's reference to
the specified String
Retrieves a reference to a
specified String
Indicates whether the specified
string is null or an Empty string
Indicates whether a specified string
is null, empty, or consists only of
white-space characters
Concatenates the elements of an
object array, using the specified
separator between each element
Determines whether the specified
instances are the same instance

Example
String.Compare(sat, sat);
0

String.CompareOrdinal(sat,
Sat);
32
String.Concat(Hello ,
there);
Hello there
String.Copy(Hello);
Hello
String.Equals(hi, Hi);
False
String.Format("(\"{0}\")
String.Intern(s2);
String.IsInterned(value);
String.IsNullOrEmpty(s);
String.IsNullOrWhiteSpace(null,
String.Empty, "ABCDE")
True, True, False
String.Join(/, His, Her);
His/Her
String.ReferenceEquals(Her,
Him);
False

Sample Programs:
Program 1:
using System;
class Program1
{
static void Main()
{
string x = String.Join(" ", "Camille", "Sequitin");

Output:
Camille Sequitin

Console.WriteLine(x);
Console.Read();
}

Program 2:
using System;
class Program1
{
static void Main()
{
Console.WriteLine(String.CompareOrdinal("sat", "Sat"));
Console.Read();
}

Output:
32

Das könnte Ihnen auch gefallen