https://www.oreilly.com/library/view/concurrency-in-c/9781492054498/

 

Concurrency in C# Cookbook, 2nd Edition

If you’re one of many developers still uncertain about concurrent and multithreaded development, this practical cookbook will change your mind. With more than 85 code-rich recipes in this updated second … - Selection from Concurrency in C# Cookbook, 2n

www.oreilly.com

 

Concurrency

  • 한 번에 두 가지 이상의 작업 수행

Multithreading

  • 다수의 실행 스레드를 사용하는 동시성의 한 형태

Parallel Processing

  • 많은 작업을 여러 스레드에 나눠서 동시에 수행
  • 멀티스레딩을 사용해서 멀티 코어 프로세서를 최대한 활용하는 방법

Asynchronous Programming

  • 불필요한 스레드의 사용을 피하려고 future나 callback을 사용하는 동시성의 한 형태

Reactive Programing

  • 애플리케이션이 이벤트에 대응하게 하는 선언형 프로그래밍 방식
  • 비동기 연산이 아닌 비동기 이벤트 기반

 

 

'.NET > C#' 카테고리의 다른 글

Concurrency - Parallel Programming  (0) 2023.08.16
Concurrency - Asynchronous Programming  (0) 2023.08.16
Marshaling: 복사 및 고정  (0) 2021.10.15
Array Marshaling  (0) 2021.10.15
Comparisons and Sorts  (0) 2021.10.15
<ObjectDataProvider x:Key="MyEnumValue_et"
                    MethodName="GetValues"
                    ObjectType="{x:Type sys:Enum}">
    <ObjectDataProvider.MethodParameters>
        <x:Type TypeName="local:MyEnumValue_et"/>
    </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

 

 

 

 

'.NET > WPF' 카테고리의 다른 글

Calendar  (0) 2021.12.24
WPF ContextMenu Tips  (0) 2021.08.15
WPF CustomControl  (0) 2021.08.15
Adorner  (0) 2021.08.15
WPF Graphics Rendering  (0) 2021.08.15

XAML:

<Calendar ...
          SelectedDatesChanged="Calendar_SelectedDatesChanged"/>

.cs:

private void Calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
{
    Mouse.Capture(null);
}

 

 

'.NET > WPF' 카테고리의 다른 글

ObjectDataProvider  (0) 2022.05.28
WPF ContextMenu Tips  (0) 2021.08.15
WPF CustomControl  (0) 2021.08.15
Adorner  (0) 2021.08.15
WPF Graphics Rendering  (0) 2021.08.15

값 형식 복사 / 관리되는 메모리에서 관리되지 않는 메모리로 참조를 통해 전달되는 형식 복사
값으로 전달되는 참조 형식은 복사 또는 고정됨

 

 

'.NET > C#' 카테고리의 다른 글

Concurrency - Asynchronous Programming  (0) 2023.08.16
Concurrency (동시성)  (0) 2023.08.16
Array Marshaling  (0) 2021.10.15
Comparisons and Sorts  (0) 2021.10.15
Debugging Tips  (0) 2021.09.15

C++

HRESULT New1(int ar[10]);  
HRESULT New2(double ar[10][20]);  
HRESULT New3(LPWStr ar[10]);

C#

void New1([MarshalAs(UnmanagedType.LPArray, SizeConst=10)] int[] ar);  
void New2([MarshalAs(UnmanagedType.LPArray, SizeConst=200)] double[] ar);  
void New2([MarshalAs(UnmanagedType.LPArray,
    ArraySubType=UnmanagedType.LPWStr, SizeConst=10)] String[] ar);

C++

HRESULT New1(int ar[]);  
HRESULT New2(int ArSize, [size_is(ArSize)] double ar[]);  
HRESULT New3(int ElemCnt, [length_is(ElemCnt)] LPStr ar[]);

C#

void New1(ref int ar);
void New2(ref double ar);
void New3(ref String ar);

배열의 요소 수를 지정하는 방법

1. 배열의 요소 수가 포함된 또 다른 매개 변수 식별, 매개 변수는 위치로 식별

void New(  
    int ElemCnt,
    [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] int[] ar);

2. 배열의 크기를 상수로 정의

void New(  
    [MarshalAs(UnmanagedType.LPArray, SizeConst=128)] int[] ar);

 

구조체 내의 배열

C++

struct MyStruct {
    int values[128];
};

C#

[StructLayout(LayoutKind.Sequential)]
public struct MyStruct
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConstant = 128)] public int[] values;
}

 

 

 

struct Image {
    unsigned char* image_ptr;
    int rows;
    int cols;
};

typedef void (*pfnCallback)(bool[], const char* [], Image[], Image, int length);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct Image
{
    public IntPtr image_ptr;
    public int rows;
    public int cols;
}

public delegate void dgCallback(
    [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1, SizeParamIndex = 4)] bool[] status,
    [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 4)] string[] id,
    [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] Image[] img_face,
    Image img_org,
    int length);

 

 

 

 

 

 

'.NET > C#' 카테고리의 다른 글

Concurrency (동시성)  (0) 2023.08.16
Marshaling: 복사 및 고정  (0) 2021.10.15
Comparisons and Sorts  (0) 2021.10.15
Debugging Tips  (0) 2021.09.15
Equals, IEquatable<T>  (0) 2021.08.15

+ Recent posts