Q1. OOP?
This is a programming paradigm based on the concept of the Object.
It has "Attribute" and "Method"
OOP languages usually support "inheritance", "encapsulation", "abstract" and "polymorphism".

Example.

using System;
using System.Collections;

namespace TestCode
{
    abstract class Car //abstract
    {
        protected string Color; //encapsulation
        protected int Speed; //encapsulation
        abstract public void SpeedUp();
    }

    class RealCar : Car //inheritance
    {
        public RealCar(string color)
        {
            this.Color = color;
            this.Speed = 0;
        }
        public override void SpeedUp()
        {
            Speed += 10;
        }

        public void DescriptionCar()
        {
            Console.WriteLine("This is {0} Car, Speed is {1}", this.Color, this.Speed.ToString());
        }
    }

    class Program
    {

        static void Main(string[] args)
        {
            RealCar car = new RealCar("Red"); //polymorphism
            car.DescriptionCar();
            car.SpeedUp();
            car.DescriptionCar();
            RealCar carB = new RealCar("Blue"); //polymorphism
            carB.DescriptionCar();
            Console.ReadLine();
         }
    }
}


Q2. Restful API?
It is a computer architecture style on the Web service. 
You can Create, Read, Update, Delete by the Restful with Json or XML.

Example URI
non-Restful : /user?id=1234
Restful : /user/{1234}

The Unity3D supported HTTP Method. so, we can easy implement it.
but, you keep the rule.
- you should write Api with small letter.
- if you want "space", you should write URL with "-" (hyphen)
- don't use extension.


Q3. Linked List

class Program
{
    static void Main(string[] args)
    {
        LinkedList<int> _LinkedList = new LinkedList<int>();
         //Add
        _LinkedList.AddLast(9);
         //Add
        _LinkedList.AddLast(3);
         //Insert
        InsertNode(_LinkedList, 9, 2);
         //Remove
        RemoveNode(_LinkedList, 3);
         //Merge
        MergeNode(ref _LinkedList);
         //Sort
         LinkedList<int> _SortList = new LinkedList<int>(_LinkedList.OrderBy(x=>x));
         //Print
         PrintList(_SortList);
        Console.ReadLine();
    }

    static void InsertNode(LinkedList<int> linkedlist, int findArg, int value )
    {
        LinkedListNode<int> _node = linkedlist.Find(findArg);
        linkedlist.AddAfter(_node, value);
    }

    static void RemoveNode(LinkedList<int> linkedlist, int findArg)
    {
        linkedlist.Remove(findArg);
    }

    static void MergeNode(ref LinkedList<int> linkedlistParents)
    {
        //TestValue
        LinkedList<int> _Child = new LinkedList<int>();
        _Child.AddLast(3);
        _Child.AddLast(7);

        linkedlistParents = new LinkedList<int>(linkedlistParents.Union(_Child));
    }

    static void PrintList(LinkedList<int> _x)
    {
        foreach (var ll in _x)
        {
            Console.WriteLine(ll);
        }
    }
}



Q4. Array 
class Program
{
    static void Main(string[] args)
    {
        int[] _intArrayA = new int[] { 1, 2, 2, 3, 4, 5, 5 };
        int[] _intArrayB = new int[] { 6,7,9,8 };

        //Merge
        int[] _MergeArray = _intArrayA.Concat(_intArrayB).ToArray();
        PrintArray(_MergeArray);

        //Count Number
        int[] _CountNum = _MergeArray.GroupBy(x => x).Select(x => new { key = x.Key, count = x.Count() }).Where(x => x.count >= 2).Select(x => x.key).ToArray();
        PrintArray(_CountNum);

        //Distract
        int[] _Dist = _MergeArray.Distinct().ToArray();
        PrintArray(_Dist);
 
        //Sort 
        int[] _Sort = _Dist.OrderBy(x=> x).ToArray();
        PrintArray(_Sort);

        Console.ReadLine();
    }

    static void PrintArray(int[] _array)
    {
        Console.WriteLine("============");
        foreach (int x in _array)
        {
            Console.WriteLine(x);
        }
    }
}




2016/04/12 12:46 2016/04/12 12:46

트랙백 주소 :: 이 글에는 트랙백을 보낼 수 없습니다