Answers for "c sharp array"

C#
6

make new array in c#

string[] stringArray = new string[6];
Posted by: Guest on July-16-2020
7

c# array

float[] array = new float[] { 1f, 5f, 4f, 3f };
Posted by: Guest on June-08-2020
3

How to make a array in c#

//use this for unity editor:
using UnityEngine;

public class MyScript : MonoBehaviour {
//You can change the variable type to int, float, strings and others
//Note: You need to asign the objects from the unity editor or the script
  
    public GameObject[] MyObjects;/*edit the size of the array in the unity editor
  								  or add = new GameObject[the length of the array]*/

    void Update(){
    //Here we are using for loop to destroy our objects in the list
        for (int i = 0; i < MyObjects.Length; i++){
            Destroy(MyObjects[i], 3.0f);/*The second parameter is how much seconds to wait 
            							before the certain object will be destroyed*/
        }
    }
}
//Sry for my english its bad
Posted by: Guest on June-09-2021
4

array in C#

// String array for my friends ( Example )
string[] myFriends = {"Friend1", "Friend2", "Friend3", "Friend4"};

// Display MyFriend2 at index of ( 1 )
Console.WriteLine(myFriends[1]);
Posted by: Guest on June-05-2021
1

c# define array

float[] floats = new float[]{1.0,1.1,1.4,1.23,2212.233};
Posted by: Guest on June-04-2021

C# Answers by Framework

Browse Popular Code Answers by Language