일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- conda
- python
- mysql
- FIND
- pi
- 쉘
- c++11
- dataframe
- Eclipse
- sqlite
- SSH
- pandas
- Shader
- ngui
- if
- autovacuum
- sql
- ubuntu
- List
- postgresql
- 배열
- SVN
- null
- boost
- with
- awk
- DROP
- Unity
- expect
- C++
- Today
- Total
목록프로그래밍/C# (16)
その先にあるもの…
C#에서 구조체를 string으로 변환public static string structToString(object obj){ int datasize = Marshal.SizeOf(obj); IntPtr buff = Marshal.AllocHGlobal(datasize); Marshal.StructureToPtr(obj, buff, false ); byte[] data = new byte[datasize]; Marshal.Copy(buff, data, 0, datasize); Marshal.FreeHGlobal(buff); return System.Text.Encoding.UTF8.GetString( data ); } public static object stringToStruct(string data, ..
C++의 함수 포인터 같은 기능이 없나 찾아보다 delegate를 발견 형식 :한정자 delegate 반환식 함수명( 매개변수 ); 이해 :객체 처럼 변수를 선언한 후 메모리에 올라가 있는 함수를 대입시켜 주면 된다. namespace Csharp_Study { public delegate int delCalculator(int a, int b); class Calculator { public int Plus(int a, int b) { return a + b; } public int Minus(int a, int b) { return a - b; } } class main { static int Mul(int a, int b) { return a * b; } static void Main(string[..
const선언 시 반드시 값을 할당해야 한다. const int x = 1; 한번 값이 할당되면 이후 변경이 불가능하다.상수는 자동으로 static이다.참조 타입은 const 일 수 없다. 동적으로 메모리에 할당되는 객체와 같은 참조타입은 const로 선어하여 초기화 할 수 없다. const int[] array = new int[] { 1, 2, 3 }; //error CS0134 - const의 값은 컴파일 시점에서 결정되어야 함 컴파일러가 const 상수를 컴파일 시 값을 어셈블리의 메타데이터에 바로 기입 new는 메모리 할당 후에 값을 기입하기 때문에 에러 - 참조 타입은 NULL로 초기화 되어야 함. - 문자열은 예외 const string str = "STRING"; const는 참조형태로 전..
인터넷 예제로 yield WaitForSeconds(0.025);구문이 나오는데 C#으로 어떻게 바꿔야 하는지 순간 당황검색으로 찾아낸 구문yield return new WaitForSeconds(0.025f); 그럼 yield는 무엇이지? 일반 함수처럼 return되면 스택이 정리되지 않고yield return을 하게 되면 다음 구문의 스택의 포인터를 기억하고 있다가지정된 명령에 따라 호출되었을 때 기억된 포인터부터 시작한다고 생각하면 될 듯 하다. yield return null : 다음 프레임까지 대기yield return WaitForSeconds(float) : 지정된 초 만큰 대기yield return new WaitForFixedUpdate() : 다음 물리 프레임까지 대기yield retu..