.NET 'System'DLL을 디스 어셈블하고 변수 클래스 (문자열, 정수, 바이트 등)의 소스 코드를 조사하여 알아낼 수 있는지 확인했습니다. 가치를 가질 수있는 수업을 만드는 방법. "Int32"클래스는 다음을 상속합니다. IComparable, IFormattable, IConvertible, IComparable, IEquatable."int"또는 "string"클래스 만들기
String 및 Int32 클래스는 상속되지 않으므로 상속 된 인터페이스에서 클래스가 값을 보유 할 수있는 것을 파악할 수 없습니다. 내가 원하는 것은 다음과 같습니다.
public class MyVariable : //inherits here
{
//Code in here that allows it to get/set the value
}
public static class Main(string[] args)
{
MyVariable a = "This is my own custom variable!";
MyVariable b = 2976;
if(a == "Hello") { }
if(b = 10) { }
Console.WriteLine(a.ToString());
Console.WriteLine(a.ToString());
}
이 컴파일을 할 수는 있지만 ... 왜? –
두 번째 if는'='(아마도'b == 10 '이어야 함) –
위 코드의 12 번째 줄에서'if (b == 10) {}'대신'if (b = 10) {}'? –