Skip to content

Instantly share code, notes, and snippets.

View kkdai's full-sized avatar

Evan Lin kkdai

View GitHub Profile
@kkdai
kkdai / MultipleIneritance.cpp
Last active August 29, 2015 13:56
Regular problem which comes from multiple inheritance
#include <iostream>
#include <stdio.h>
class L
{
private:
int a1=1;
public:
L():a1(2), a2(a1) //Don't use like this, a2 result depends on compiler
{}
@kkdai
kkdai / Vincent_lambda.cs
Created February 13, 2014 12:39
Try to converse it back to delegate or .Net 2.0
Mapper.CreateMap<DTOObject, MainObject>().ForMember(
d => d.TopObject,
mc => mc.MapFrom(s => new SubObject(){
SubPropText = s.TopText,
SubPropFont = s.TopFont
}
));
//-->
@kkdai
kkdai / lambda.cs
Created February 14, 2014 00:50
Some sample about lambda
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
static class Program
{
#include <iostream>
#include <stdio.h>
class L
{
private:
int a1=1;
public:
L():a1(2), a2(a1) //Don't use like this, a2 result depends on compiler
{}
class AA
{
public:
AA()
{
printf("1");
}
virtual void F1()
{
printf("2");
#include <iostream>
#include <stdio.h>
#define FOO_Def
#define FOO_Def2 5
int main(int argc, const char * argv[])
{
#include <iostream>
#include <stdio.h>
#define FOO_Def
#define FOO_Def2 5
inline int foo1(int x)
{
return x*5+8;
}
#define macro(x) x* 5 + 8
#include <iostream>
class AA
{
public:
static int i;
//static int i = 0; // compile error
static const int KKKK= 10;//OKAY
int k = 0; //warning, just allow after c++/11 to initialize value in class
void fool(){printf("the value of i is %d\n", i);}//static function only can use "static const", can't use "static" variables
private async void LoadImage_Click_1(object sender, RoutedEventArgs e)
{
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Image/Tulips.jpg"));
using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
{
BitmapImage image = new BitmapImage();
image.SetSource(fileStream);
Scenario4Image.Source = image;
}
}
#include <iostream>
#include <stdio.h>
int main(int argc, const char * argv[])
{
#define PRINTX(x) std::cout << #x << " = " <<x <<"\n"
// ANSI C 比 K&R C 功能多了 # 及 ## ,這部份其實是 #2 的續篇
// 在 #2 中說到 ANSI 及 K&R 差異,現在再加上此部份,ANSI C 又