reflect.SliceOf() Function in Golang with Examples Last Updated : 28 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.SliceOf() Function in Golang is used to get the slice type with element type t, i.e., if t represents int, SliceOf(t) represents []int. To access this function, one needs to imports the reflect package in the program. Syntax: func SliceOf(t Type) Type Parameters: This function takes only one parameters of Type type(t). Return Value: This function returns the slice type with element type t. Below examples illustrate the use of above method in Golang: Example 1: C // Golang program to illustrate // reflect.SliceOf() Function package main import ( "fmt" "reflect" ) // Main function func main() { v := reflect.TypeOf("123") // use of SliceOfmethod fmt.Println(reflect.SliceOf(v)) } Output: []string Example 2: C // Golang program to illustrate // reflect.SliceOf() Function package main import ( "fmt" "reflect" ) // Main function func main() { ta := reflect.ArrayOf( 10, reflect.TypeOf("123")) tc := reflect.ChanOf(reflect.SendDir, ta) tp := reflect.PtrTo(tc) ts := reflect.SliceOf(tp) // use of SliceOf method fmt.Println(ts) } Output: []*chan<- [10]string Comment More infoAdvertise with us Next Article reflect.SliceOf() Function in Golang with Examples S SHUBHAMSINGH10 Follow Improve Article Tags : Go Language Golang-reflect Similar Reads reflect.ValueOf() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.ValueOf() Function in Golang is used to get the new Value initialized to the concrete value stored in the interfa 2 min read reflect.StructOf() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.StructOf() Function in Golang is used to get the struct type containing fields. To access this function, one need 2 min read reflect.TypeOf() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.TypeOf() Function in Golang is used to get the reflection Type that represents the dynamic type of i. To access th 1 min read reflect.Select() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Select() Function in Golang is used to executes a select operation described by the list of cases. To access this 2 min read reflect.Set() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Set() Function in Golang is used to assigns x to the value v. To access this function, one needs to imports the r 2 min read reflect.SetBool() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.SetBool() Function in Golang is used to sets v's underlying value. To access this function, one needs to imports 2 min read reflect.String() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.String() Function in Golang is used to get the string v's underlying value, as a string. To access this function, 2 min read reflect.Swapper() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Swapper() Function in Golang is used to swaps the elements in the provided slice. To access this function, one ne 3 min read reflect.Type() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Type() Function in Golang is used to get v's type. To access this function, one needs to imports the reflect pack 1 min read reflect.TrySend() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.TrySend() Function in Golang attempts to send x on the channel v but will not block. To access this function, one 2 min read Like