赞
踩
####ArrayList存在不安全类型(ArrayList会把所有插入其中的数据都当做Object来处理) 装箱拆箱的操作(费时) List是接口,ArrayList是一个实现了该接口的类,可以被实例化
void Awake()
{
DontDestroyOnLoad(transform.gameObject);
}
foreach (Type type in assembly.GetTypes())
{
string t = type.Name;
}
string a = new string("abc");
a = (a.ToUpper() + "123").Substring(0, 2);
string b = new string(new char[]{'a','b','c'});
List<int> ls = new List<int>(new int[] { 1, 2, 3, 4, 5 });
foreach (int item in ls)
{
Console.WriteLine(item * item);
ls.Remove(item);
}
char * strcpy(char * strDest,const char * strSrc)
{
if ((strDest==NULL)||(strSrc==NULL))
throw "Invalid argument(s)";
char * strDestCopy=strDest;
while ((*strDest++=*strSrc++)!='\0');
return strDestCopy;
}
int Fib1(int index)
{
if(index
int Fib5(int index)
{
if(index
function Start() {
// 协同程序WaitAndPrint在Start函数内执行,可以视同于它与Start函数同步执行.
StartCoroutine(WaitAndPrint(2.0));
print ("Before WaitAndPrint Finishes " + Time.time );
}
function WaitAndPrint (waitTime : float) {
// 暂停执行waitTime秒
yield WaitForSeconds (waitTime);
print ("WaitAndPrint "+ Time.time );
}
using UnityEngine;
using System.Collections;
public class MovieTest : MonoBehaviour
{
//视频纹理
protected MovieTexture movTexture;
AudioClip audio;
AudioSource AudioSource1;
void Start()
{
StartCoroutine(DownLoadMovie());
}
void OnGUI()
{
if (GUILayout.Button("播放/继续"))
{
//播放/继续播放视频
if (!movTexture.isPlaying)
{
movTexture.Play();
AudioSource1.Play();
}
}
if (GUILayout.Button("暂停播放"))
{
//暂停播放
movTexture.Pause();
AudioSource1.Pause();
}
if (GUILayout.Button("停止播放"))
{
//停止播放
movTexture.Stop();
AudioSource1.Stop();
}
}
IEnumerator DownLoadMovie()
{
WWW www = new WWW ("http://127.0.0.1/Wildlife.ogg");//"file://" + Application.dataPath + "/Resources/Wildlife.ogg");
yield return www;
movTexture = www.movie;
//获取主相机的声源
AudioSource1 = Camera.main.GetComponent(typeof(AudioSource)) as AudioSource;
//获取视频的声音设置到声源上
AudioSource1.clip = movTexture.audioClip;
audio = AudioSource1.clip;
//设置当前对象的主纹理为电影纹理
renderer.material.mainTexture = movTexture;
//设置电影纹理播放模式为循环
movTexture.loop = true;
}
}
delegate b Func<a, b>(a a1);
static void Main(string[] args)
{
Func<int, bool> mFunc = x => x == 5;
Console.WriteLine(mFunc(6));
}
uint BitCount (uint n)
{
uint c = 0; // 计数器
while (n > 0) {
if ((n & 1) == 1) // 当前位是1
++c; // 计数器加1
n >>= 1; // 移位
}
return c;
}
public Transform GetChild(int index);
public int Transform.childCount
public void OutputTree(Transform root)
{
}
unsigned int getN(unsigned int v){
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
return v;
}
int func(int n)
{
if(n<=2) return 1;
return n + func(n-1);
}
s = a;
for(b = 1; b <= c; b++)
s = s + 1;
;
Console.ReadLine(num) int s = 0; for(int i = 1; i <= num; i++) { s += JieCheng(num); } public int JieCheng(int num) { if(num < 0) { Console.WriteLine("error"); return; } if(num <=1) { return 1; } else { return num * JieCheng(num - 1) } }
int GetResult(char[] input, char[] output) { int i, j, k = 0; int flag; int length; if(input == NULL || output == NULL) { return -1; } length=strlen(input);//求数组的长度 for(i = 0; i<length; i++) { flag = 1; for(j = 0; j < i; j++) { if(output[j] == input [i]) flag = 0; } if(flag) output[k++] = input[i]; } printf("最终的字符串为:"); output[k] = '\0'; for(int m = 0; m < output.Length; m++) { print (output [m]); } return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。