People p1 = new People() { name = "A", age = 4 };
People p2 = new People() { name = "B", age = 5 };
People p3 = new People() { name = "C", age = 6 };
People p4 = new People() { name = "E", age = 7 };
People p5 = new People() { name = "F", age = 8 };

List<People> pList = new List<People>() { p1, p2, p3, p4, p5 };

 

Exam e1 = new Exam() { name = "A", subject = "과학" };
Exam e2 = new Exam() { name = "B", subject = "수학" };
Exam e3 = new Exam() { name = "A", subject = "수학" };
Exam e4 = new Exam() { name = "D", subject = "영어" };
Exam e5 = new Exam() { name = "C", subject = "기술" };
Exam e6 = new Exam() { name = "C", subject = "과학" };
List<Exam> eList = new List<Exam>() { e1, e2, e3, e4, e5, e6 };

 

var joinQuery = from pl in pList
                      join el in eList
                      on pl.name equals el.name
                      into joined
                      select new { Person = pl, Count = joined.Count() }; 

 

foreach (var grouped in joinQuery)
{
    Console.WriteLine("{0},{1}", grouped.Person.name, grouped.Count);
}

 

결과

A,2
B,1
C,2
E,0
F,0

 

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

(Linq) 점표기식  (0) 2017.04.14
(Linq) Cross Join  (0) 2017.04.14
(Linq) linq - join into  (0) 2017.04.14
(Linq) Linq to DataSet  (0) 2017.04.14
(Linq) linq to xml  (0) 2017.04.14
(Linq) linq T Type Join result T Type  (0) 2017.04.14

DataTable dt = new DataTable();
dt.Columns.Add("name");
dt.Columns.Add("age");
dt.Columns.Add("birth");

dt.Rows.Add("강준", "35", "1980.09.18");
dt.Rows.Add("이가영", "35", "1980.10.13");
dt.Rows.Add("강하담", "1", "2014.04.10");

 

var selectData = dt.AsEnumerable().Where(c => c.Field<string>("name") == "강준")
                                                  .Select(c => new { Name = c.Field<string>("name"),

                                                                                Age = c.Field<string>("Age"),

                                                                               Birth = c.Field<string>("birth") }); 

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

(Linq) Cross Join  (0) 2017.04.14
(Linq) linq - join into  (0) 2017.04.14
(Linq) Linq to DataSet  (0) 2017.04.14
(Linq) linq to xml  (0) 2017.04.14
(Linq) linq T Type Join result T Type  (0) 2017.04.14
(WPF) wpf 관련 리소스 정리  (0) 2017.04.13

// 간단한 xml 예제

var root = new XElement("root",
                        new XAttribute("attr", "value"),
                        new XElement("child", "test"));

 

결과

<root attr="value">
  <child>test</child>
</root>

 

-----------------------------------------------------------

// List 에 담긴 내용을 linq 를 이용해 쉽게 xml 형태로 변환이 가능합니다.

People p1 = new People() { name = "A", age = 4 };
People p2 = new People() { name = "B", age = 5 };
People p3 = new People() { name = "C", age = 6 };
People p4 = new People() { name = "E", age = 7 };
People p5 = new People() { name = "F", age = 8 };
List<People> pList = new List<People>() { p1, p2, p3, p4, p5 };

 

var peoples = new XElement("Peoples",
    from p in pList
    select new XElement("People",
                                   new XAttribute("name", p.name),
                                   new XAttribute("age", p.age)));

 

결과

<Peoples>
  <People name="A" age="4" />
  <People name="B" age="5" />
  <People name="C" age="6" />
  <People name="E" age="7" />
  <People name="F" age="8" />
</Peoples>

 

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

(Linq) linq - join into  (0) 2017.04.14
(Linq) Linq to DataSet  (0) 2017.04.14
(Linq) linq to xml  (0) 2017.04.14
(Linq) linq T Type Join result T Type  (0) 2017.04.14
(WPF) wpf 관련 리소스 정리  (0) 2017.04.13
(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
public class User
{
   
public int UserId { get; set; }
   
public string UserName { get; set; }
   
public string Email { get; set; }
    public string CompanyName { get; set; }
}

var users = from A in A_Users
                 join B
in B_Users on u.UserId equals mem.UserId
                select new User
               
{
                    UserId = A.UserId,
                   
UserName = A.UserName,
                   
Email = A.Email,
                    CompanyName = companies.CompanyName

                
};

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

(Linq) Linq to DataSet  (0) 2017.04.14
(Linq) linq to xml  (0) 2017.04.14
(Linq) linq T Type Join result T Type  (0) 2017.04.14
(WPF) wpf 관련 리소스 정리  (0) 2017.04.13
(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
(.NET) async, await 비동기 샘플 코드  (0) 2017.04.13
WPF

시작(WPF)
응용 프로그램 개발
WPF 기본 사항
액세스 가능성
컨트롤
데이터
문서
그래픽 및 멀티미디어
전역화 및 지역화
마이그레이션 및 상호 운용성
보안(WPF)
샘플(WPF)
일반 참조(WPF)
클래스 라이브러리(WPF)
도구(WPF)

출처 : HOONS.NET

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

(Linq) linq to xml  (0) 2017.04.14
(Linq) linq T Type Join result T Type  (0) 2017.04.14
(WPF) wpf 관련 리소스 정리  (0) 2017.04.13
(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
(.NET) async, await 비동기 샘플 코드  (0) 2017.04.13
(.NET) 이펙티브 C# - 요점 정리  (0) 2017.04.13

1

2

 

3. 컨텐트

* SizeToContent = SizeToContent.WidthAndHeight; : 컨텐트에 맞춰서 창을 조정한다.

 

* 이미지 삽입

            Uri uri = new Uri(http://www.charlespetzold.com/PetzoldTattoo.jpg);

            // Uri uri = new Uri("pack://application:,,,/1439813578408.jpg"); - 솔루션내의 이미지 가져오기
            BitmapImage bitmap = new BitmapImage(uri);
            Image img = new Image();
            img.Source = bitmap;
            Content = img;

 

- Uri uri = new Uri(System.IO.Path.Combine(Environment.GetEnvironmentVariable("windir"), "Gone Fishing.bmp"));

 

* TextBlock

            TextBlock txt = new TextBlock();
            txt.FontSize = 32; // 24 포인트
            txt.Inlines.Add("This is some ");
            txt.Inlines.Add(new Italic(new Run("italic")));
            txt.Inlines.Add(" text, and this is some ");
            txt.Inlines.Add(new Bold(new Run("bold")));
            txt.Inlines.Add(" text, and let's cap it off with some ");
            txt.Inlines.Add(new Bold(new Italic(new Run("bold italic"))));
            txt.Inlines.Add(" text.");
            txt.TextWrapping = TextWrapping.Wrap;
            Content = txt;

 

4. 버튼

Button btn = new Button();
btn.Content = "_Click me, please!";

이상태에서 alt+c 를 누르면 단축키로 활용이 가능하다  _ 를 넣으면 된다.

- Command

            Button btn = new Button();

            btn.HorizontalAlignment = HorizontalAlignment.Center;
            btn.VerticalAlignment = VerticalAlignment.Center;
            btn.Command = ApplicationCommands.Paste;
            btn.Content = ApplicationCommands.Paste.Text;

            Content = btn;

            // Command와 이벤트 핸들러의 바인딩
            CommandBindings.Add
            (
                new CommandBinding
                (
                    ApplicationCommands.Paste,
                    PasteOnExecute,
                    PasteCanExecute
                )
            );
        void PasteOnExecute(object sender, ExecutedRoutedEventArgs args)
        {
            Title = Clipboard.GetText();
        }

        void PasteCanExecute(object sender, CanExecuteRoutedEventArgs args)
        {

            // 클립보드에 있는 내용이 문자인지 확인하여 문자면 버튼을 활성화 한다.
            args.CanExecute = Clipboard.ContainsText();
        }

 

- CheckBox, ToggleButton

ToggleButton btn = new ToggleButton();
btn.SetBinding(ToggleButton.IsCheckedProperty, "Topmost"); // 체크발생시 Topmost 값을 변경한다.

//  어떤 Window의 Topmost 프로퍼티를 참조하는지 따로 알 수 없기 때문에 버튼의 DataContext 프로퍼티에 Window 객체를 지정해야 한다.
btn.DataContext = this;

Content = btn;
ToolTip tip = new ToolTip();
tip.Content = "Toggle the button on to make the window topmost on the desktop";
btn.ToolTip = tip; 

 

 

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

(Linq) linq T Type Join result T Type  (0) 2017.04.14
(WPF) wpf 관련 리소스 정리  (0) 2017.04.13
(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
(.NET) async, await 비동기 샘플 코드  (0) 2017.04.13
(.NET) 이펙티브 C# - 요점 정리  (0) 2017.04.13
(WCF) .net CORE WCF  (0) 2017.04.13

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Caller();
            Console.ReadLine();
        }

        async static private void memethodAsync(int count)
        {
            Console.WriteLine("C");
            Console.WriteLine("D");

            await Task.Run(async () =>
            {
                for (int i = 1; i <= count; i++)
                {
                    Console.WriteLine(i.ToString());

                }
            }
            );
            Console.WriteLine("G");
            Console.WriteLine("H");
        }


        static void Caller()
        {
            Console.WriteLine("A");
            Console.WriteLine("B");

            memethodAsync(5);

            Console.WriteLine("E");
            Console.WriteLine("F");
        }
   
   
    }
}


결과


A
B
C
D
E
F
1
2
3
4
5
G
H

 

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

(WPF) wpf 관련 리소스 정리  (0) 2017.04.13
(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
(.NET) async, await 비동기 샘플 코드  (0) 2017.04.13
(.NET) 이펙티브 C# - 요점 정리  (0) 2017.04.13
(WCF) .net CORE WCF  (0) 2017.04.13
(WCF) Setting  (0) 2017.04.13
Uri uri = Uri.parse("content://mms/");
String selection = "_id = " + mmsId;
Cursor cursor = getContentResolver().query(uri, null, selection, null, null);
 
 
 
String selectionPart = "mid=" + mmsId;
Android.Net.Uri uri = Android.Net.Uri.parse("content://mms/part");
Android.Database.ICursor cursor = ContentResolver.Query(uri, null,
    selectionPart, null, null);
if (cursor.MoveToFirst())
{
    do
    {
        String partId = cursor.GetString(cursor.GetColumnIndex("_id"));
        String type = cursor.GetString(cursor.GetColumnIndex("ct"));
        if ("text/plain".Equals(type))
        {
            String data = cursor.GetString(cursor.GetColumnIndex("_data"));
            String body;
            if (data != null)
            {
                // implementation of this method below
                body = GetMmsText(partId);
            }
            else
            {
                body = cursor.GetString(cursor.GetColumnIndex("text"));
            }
        }
    } while (cursor.MoveToNext());
}

private string getMmsText(String id)
{
    Android.Net.Uri partURI = Android.Net.Uri.Parse("content://mms/part/" + id);
    Stream inputStream = null;
    Java.Lang.StringBuilder sb = new Java.Lang.StringBuilder();
    try
    {
        inputStream = ContentResolver.OpenInputStream(partURI);
        if (inputStream != null)
        {
            Java.IO.InputStreamReader isr = new Java.IO.InputStreamReader(inputStream, "UTF-8");
            Java.IO.BufferedReader reader = new Java.IO.BufferedReader(isr);
            string temp = reader.ReadLine();
            while (temp != null)
            {
                sb.Append(temp);
                temp = reader.ReadLine();
            }
        }
    }
    catch (IOException e) { }
    finally
    {
        if (inputStream != null)
        {
            try
            {
                inputStream.Close();
            }
            catch (IOException e) { }
        }
    }
    return sb.ToString();
}
 

 

http://mobilism.tistory.com/entry/이펙티브-C-요점-정리

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

(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
(.NET) async, await 비동기 샘플 코드  (0) 2017.04.13
(.NET) 이펙티브 C# - 요점 정리  (0) 2017.04.13
(WCF) .net CORE WCF  (0) 2017.04.13
(WCF) Setting  (0) 2017.04.13
(WCF) Transaction 전달  (0) 2017.04.13
1. 사용방법

2. sqlite-net 깃허브 소스
https://github.com/praeclarum/sqlite-net

3. mono.data.sqlite 설치방법

+ Recent posts

티스토리 툴바