본문 바로가기
  • Being.Doing
  • Being.Doing
  • Being.Doing

C#10

C# 파라미터와 int형으로 강제형변환 강제 형변환시 파라미터의 응용. 파라미터 이 친구가 있어서 참 고맙다 파라미터의 사용법은 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Test : MonoBehaviour { int intValue; float floatValue = 6.6f; float floatValue2 = 7.7f; void FloatToInt(float _parameter) //함수의 첫글자는 항상 대문자. //마자 함수 이용해주면 깔끔하게 1번만사용할 수 있어서! 조야용 //함수를 두개만들 수 있는데 그러면 매우 비효율 적이니까 { intValue = (int)_parameter; print(intValue).. 2021. 5. 11.
C# var using System; namespace ConsoleApp20 { class Program { static void Main(string[] args) { //var는 var a = 20; Console.WriteLine("Type:{0},Value:{1}", args.GetType(), a); ; } } } 2021. 4. 28.
C# if문을 더 줄여서 쓰고 싶읍니까? using System; namespace ConsoleApp20 { class Program { static void Main(string[] args) { string name = ""; Console.ReadLine(""); int age = ""; Console.ReadLine(""); Console.WriteLine($"{name},{(age >20 ? "늙은이" : "젊은이")}"); } } } 2021. 4. 28.
C# ?? NULL 사랑해? using System; namespace ConsoleApp20 { class Program { static void Main(string[]args) { int? a = null; // 널이 포함되어있는 값에만 쓸수있는 오퍼레이터 a ?? 3; // a 좋은 예 int? b = 3; b ?? 4; // b 안좋은 예 //a는 가능 한데 b는 안된다. //b.HasValue; //b 에 값을 물어보는 형태. Console.WriteLine() } } 2021. 4. 28.

loading