了解函数内的参数 [英] Understanding parameter within function

查看:54
本文介绍了了解函数内的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello 
I am new to programming, if you can help with small code what it means
public void Encode(Video video){
//function 
}
what this (Video video) means?
I am little confuse with it.
below is the link, video at 1:26 is the code
<a href="">https://www.youtube.com/watch?v=jQgwEsJISy0</a>

What I have tried:

<pre>public void Encode(Video video){
//function 
}

推荐答案

从这里开始:功能 [ ^ ]


声明方法时,声明语句有几个部分:

When you declare a method, the declaration statement has several parts:
access-type return-type method-name (parameter-list) 
   { 
   ... body ...
   }

其中

Where

access-type is one of private, public, protected, internal, protected internal, or omitted completely.

return-type defines what type of value the method returns to the caller

method-name defines what name will be used to execute the method from other code

parameter-list defines what values must be passed to the method when it is called.

参数列表是一系列参数定义,用逗号分隔:

The parameter-list is a sequence of parameter definitions, separated by commas:

access-type return-type method-name (parameter-definition, parameter-definition, ...)



每个参数定义声明一个局部变量,该变量仅在方法中可用,并且调用方法时必须传递一个值。该定义的格式与普通变量的格式完全相同:


Each parameter-definition declares a local variable which is available only within the method, and which must be passed a value when you call the method. The definition follows exactly the same format as that for a "normal" variable:

variable-type variable-name (with an optional initializer)



变量类型可以是代码中此时系统已知的任何类型 - 这包括您习惯的所有类型,例如 int string byte [] ,依此类推,但也包括任何类型您可以在代码中定义,或通过外部程序集导入。



因此您的方法声明


And the variable-type can be any type which is known to the system at that point in the code - this includes all the types you are used to, such as int, string, byte[], and so on, but also any of the types that you can define in your code, or import via an external assembly.

So your method declaration of

public void Encode(Video video)
   {
   ...
   }

表示该方法接受一个 Video 类型的参数,并且可以通过名称<$ c $在方法中访问c>视频



类型视频大概是类型类型在代码中的其他地方定义 - 它不是st andard .NET类名。



这就是为什么我讨厌你的管视频教程:它们通常由很少或根本没有实际知识,训练能力较差的人制作比视频技能。忽略他们,得到一本书 - 或者更好的课程 - 并正确学习。视频教程通常是完全浪费你的时间,时间和电子......

Says that the method accepts a parameter which is a Video type, and is accessible within the method by the name video

The type Video is presumably a class type that has been defined elsewhere in the code - it's not a standard .NET class name.

This is why I hate you-tube video tutorials: they are generally made by people with little or no actual knowledge, and less training ability than video skills. Ignore them, get a book - or better a course - and learn properly. video tutorials are normally a complete and utter waste of your time, his time, and electrons...


这篇关于了解函数内的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆