KO CSharp Operator Cast - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

ะฃะบั€ะฐั—ะฝััŒะบะฐ ยท ะ ัƒััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซ”ไธญๆ–‡ ยท ๆ—ฅๆœฌ่ชž ยท ํ•œ๊ตญ์–ด

๋ช…์‹œ์  ๋ณ€ํ™˜

ํ•ธ๋“œ๋ถ C# ยท ์‹ค์šฉ ๊ฐ€์ด๋“œ

๋ช…์‹œ์  ๋ณ€ํ™˜, ํŠนํžˆ ์ˆซ์ž, ์ฐธ์กฐ ์บ์ŠคํŠธ ๋˜๋Š” ์‚ฌ์šฉ์ž ์ •์˜ ๋ช…์‹œ์  ์—ฐ์‚ฐ์ž๋ฅผ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค. ๋ถˆ๊ฐ€๋Šฅํ•œ ์ฐธ์กฐ ์บ์ŠคํŠธ๋กœ ์ธํ•ด ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

๊ฐ„๋‹จํ•œ ์˜ˆ์ œ (Example.cs)

์ด ์˜ˆ์ œ๋ฅผ Example.cs๋กœ ๋”ฐ๋กœ ์ €์žฅํ•˜๊ณ  ์ด ํŽ˜์ด์ง€์˜ ๋‹ค๋ฅธ ์˜ˆ์ œ์™€ ๋…๋ฆฝ์ ์œผ๋กœ ์‹คํ–‰ํ•˜์„ธ์š”.

Example.cs:

// PROJECT-EXAMPLE
double value = 3.9;
System.Console.WriteLine((int)value);

๊ฒฐ๊ณผ:

3

ํ†ต์‚ฌ๋ก 

(TargetType)value

์˜ˆ์‹œ 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        double value = 12.75;
        int whole = (int)value;
        Console.WriteLine(whole);
    }
}

์˜ˆ์‹œ 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        object value = "ore";
        string name = (string)value;
        Console.WriteLine(name.Length);
    }
}

๊ณต์‹ ์ถœ์ฒ˜: Microsoft ํ•™์Šต.