翻訳と辞書
Words near each other
・ TypeCon
・ TypeCon2008 Buffalo
・ Typed assembly language
・ Typed lambda calculus
・ Typedef
・ Typee
・ Typeeto
・ Typeface
・ Typeface (film)
・ Typeface anatomy
・ Typeful programming
・ Typekit
・ TypeMatrix
・ Typename
・ Typenturm
Typeof
・ TypePad
・ TypeParameter
・ TypeRacer
・ Types and Programming Languages
・ Types of abortion restrictions in the United States
・ Types of artificial neural networks
・ Types of Bakuvian Bazaars
・ Types of bowlers in cricket
・ Types of business entity
・ Types of business entity in Russia
・ Types of capacitor
・ Types of cheese
・ Types of chocolate
・ Types of climbing


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Typeof : ウィキペディア英語版
Typeof

typeof (alternately typeOf or TypeOf) is an operator provided by several programming languages which determines the data type of a given variable. This can be useful when constructing parts of programs that need to accept many types of data but may need to take different action depending on the type of data provided.
In languages that support polymorphism and type casting, the typeof operator can have one of two distinct meanings when applied to an object. In some languages, such as Visual Basic,〔https://msdn.microsoft.com/en-us/library/0ec5kw18(VS.80).aspx "TypeOf Operator (Visual Basic)" in MSDN〕 the typeof operator returns the dynamic type of the object. That is, it tells the program what the true, original type of the object is, irrespective of any type casting. In these languages, the typeof operator is the method for obtaining run-time type information.
In other languages, such as C#〔https://msdn.microsoft.com/en-us/library/58918ffs(VS.80).aspx "typeof (C#)" in MSDN〕 or D〔http://digitalmars.com/d/1.0/declaration.html#Typeof〕 and some nonstandard extensions to C and C++,〔http://gcc.gnu.org/onlinedocs/gcc/Typeof.html "Typeof" in Using the GNU Compiler Collection〕 the typeof operator returns the static type of the object. That is, it tells the program what type the object is declared to be at that point in the program, irrespective of its original form. These languages usually have other constructs for obtaining run-time type information, such as typeid.
==Examples==

* In the C programming language, the GCC extension provides typeof (copied from 〔).

#define max(a,b) \
()

* In C#:

// Given an object, returns if it is an integer.
// The "is" operator can be also used to determine this.
public static bool IsInteger(object o)

* In VB.NET
The C# variant of "typeof" should be translated into the VB.NET's ''GetType'' method. TypeOf keyword in VB.NET is used to compare an object reference variable to a data type.
The following example uses TypeOf...Is expressions to test the type compatibility of two object reference variables with various data types.

Dim refInteger As Object = 2
MsgBox("TypeOf Object() Is Integer? " & TypeOf refInteger Is Integer)
MsgBox("TypeOf Object() Is Double? " & TypeOf refInteger Is Double)
Dim refForm As Object = New System.Windows.Forms.Form
MsgBox("TypeOf Object() Is Form? " & TypeOf refForm Is System.Windows.Forms.Form)
MsgBox("TypeOf Object() Is Label? " & TypeOf refForm Is System.Windows.Forms.Label)
MsgBox("TypeOf Object() Is Control? " & TypeOf refForm Is System.Windows.Forms.Control)
MsgBox("TypeOf Object() Is IComponent? " & TypeOf refForm Is System.ComponentModel.IComponent)

* In JavaScript:

function isNumber(n)


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Typeof」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.