c#二維數據最大最小值_C#| 打印類型,各種數據類型的最大值和最小值

c#二維數據最大最小值

In the below example – we are printing types, min value, max value of various data types in C#, like integer data types, floating point data types, Boolean data type, Reference types, Nullable types.

在下面的示例中-我們正在打印C#中各種數據類型的類型,最小值,最大值 ,例如整數數據類型,浮點數據類型,布爾數據類型,引用類型,可空類型。

Program:

程序:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataTypes
{
class MyDataType
{
public string Show()
{
return ("MyType");
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("VALUE TYPE:");
Console.WriteLine("---------------------------------------------");
Console.WriteLine("Integers:");
byte a = 12;
Console.WriteLine("byte\tA = {0}\t{1}\t{2}\t{3}", a, typeof(byte), byte.MaxValue, byte.MinValue);
sbyte b = 12;
Console.WriteLine("sbyte\tB = {0}\t{1}\t{2}\t{3}", b, typeof(sbyte), sbyte.MaxValue, sbyte.MinValue);
short c = 12;
Console.WriteLine("short\tC = {0}\t{1}\t{2}\t{3}", c, typeof(short), short.MaxValue, short.MinValue);
ushort d = 12;
Console.WriteLine("ushort\tD = {0}\t{1}\t{2}\t{3}", d, typeof(ushort), ushort.MaxValue, ushort.MinValue);
int e = 12;
Console.WriteLine("int\tE = {0}\t{1}\t{2}\t{3}", e, typeof(int), int.MaxValue, int.MinValue);
uint f = 12;
Console.WriteLine("unit\tF = {0}\t{1}\t{2}\t{3}", f, typeof(uint), uint.MaxValue, uint.MinValue);
long g = 12;
Console.WriteLine("long\tG = {0}\t{1}\t{2}\t{3}", g, typeof(long), long.MaxValue, long.MinValue);
ulong h = 12;
Console.WriteLine("ulong\tH = {0}\t{1}\t{2}\t{3}", h, typeof(ulong), ulong.MaxValue, ulong.MinValue);
Console.WriteLine("\nFloating Point:");
float i = 123.34f;
Console.WriteLine("float\tI = {0}\t{1}\t{2}\t{3}", i, typeof(float), float.MaxValue, float.MinValue);
double j = 123.34;
Console.WriteLine("double\tJ = {0}\t{1}\t{2}\t{3}", j, typeof(double), double.MaxValue, double.MinValue);
decimal k = 123.34m;
Console.WriteLine("decimal\tK = {0}\t{1}\t{2}\t{3}", k, typeof(decimal), decimal.MaxValue, decimal.MinValue);
Console.WriteLine("\nText:");
char l = 'f';
Console.WriteLine("char\tL = {0}\t{1}", l, typeof(char));
Console.WriteLine("\nBoolean:");
bool m = true;
Console.WriteLine("bool\tM = {0}\t{1}", m, typeof(bool));
Console.WriteLine("\nREFERENCE TYPE:");
Console.WriteLine("---------------------------------------------");
string n = "Hello";
Console.WriteLine("string\tn = {0}\t{1}", n, typeof(string));
object o = 12.34;
Console.WriteLine("object\tn = {0}\t{1}", o, typeof(object));
MyDataType p = new MyDataType();
Console.WriteLine("MyDataType\tp = {0}\t{1}", p.Show(), typeof(MyDataType));
int[] q = { 12, 45, 56 };
Console.WriteLine("int[]\tq = {0}",typeof(int[]));
Console.WriteLine("\nNullable TYPE:");
Console.WriteLine("---------------------------------------------");
string r = null;
Console.WriteLine("string\tr = {0}\t{1}", r, typeof(string));
int? s = null;
Console.WriteLine("int\ts = {0}\t{1}", s, typeof(int?));
Console.ReadKey();
}
}
}

Output

輸出量

VALUE TYPE:
---------------------------------------------
Integers:
byte    A = 12  System.Byte     255     0
sbyte   B = 12  System.SByte    127     -128
short   C = 12  System.Int16    32767   -32768
ushort  D = 12  System.UInt16   65535   0
int     E = 12  System.Int32    2147483647      -2147483648
unit    F = 12  System.UInt32   4294967295      0
long    G = 12  System.Int64    9223372036854775807     -9223372036854775808
ulong   H = 12  System.UInt64   18446744073709551615    0
Floating Point:
float   I = 123.34      System.Single   3.402823E+38    -3.402823E+38
double  J = 123.34      System.Double   1.79769313486232E+308   -1.79769313486232E+308
decimal K = 123.34      System.Decimal  79228162514264337593543950335   -79228162514264337593543950335
Text:
char    L = f   System.Char
Boolean:
bool    M = True        System.Boolean
REFERENCE TYPE:
---------------------------------------------
string  n = Hello       System.String
object  n = 12.34       System.Object
MyDataType      p = MyType      DataTypes.MyDataType
int[]   q = System.Int32[]
Nullable TYPE:
---------------------------------------------
string  r =     System.String
int     s =     System.Nullable`1[System.Int32]

翻譯自: https://www.includehelp.com/dot-net/print-type-max-and-min-value-of-various-data-types.aspx

c#二維數據最大最小值

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542495.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542495.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542495.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

自定義taglib引入失敗_小程序拼團總失敗?看看微信官方和開發者們怎么說

閱讀時間:6m最懂小程序生態商業的自媒體可怕... 剛過國慶,南方還在短袖短裙,北方竟然都下雪了!什么叫一天之內感受四季?曉程序觀察(yinghoo-tech)的小伙伴們算是深刻體驗了,穿著短袖上飛機,抵達…

微信公眾平臺開發5:翻譯功能

思路分析首先對用戶發送過來的消息進行判斷,判斷消息里是否含有“翻譯”關鍵字,如果有,則提取翻譯內容,然后調用網絡上開放的翻譯API 進行翻譯。我們用有道翻譯API:http://fanyi.youdao.com/openapi?pathdata-mode記下…

Linux之基礎I/O

目錄 一、C語言中的文件操作 二、系統文件操作I/O 三、文件描述符fd 1、文件描述符的引入 2、對fd的理解 3、文件描述符的分配規則 四、重定向 1、重定向的原理 2、重定向的系統調用dup2 五、Linux下一切皆文件 一、C語言中的文件操作 1、打開和關閉 在C語言的文…

moore和mealy_Mealy機和Moore機的比較研究 目錄

moore和mealyFinite automata may also have outputs corresponding to each input symbol. Such finite automata are known as finite automata with the output. 有限自動機還可以具有與每個輸入符號相對應的輸出。 這種有限自動機稱為輸出的有限自動機。 There are two fi…

oracle sys連接不上,oracle – 為什么我不能在SYS擁有的對象上創建觸發器?

在嘗試創建名為ghazal_current_bef_upd_row的觸發器時&#xff1a;create trigger ghazal_current_bef_upd_rowbefore update on ghazal_currentfor each rowwhen (new.Rating < old.Rating)begininsert into ghazal_current_audit(GhazalName,Old_Rating,New_Rating)values…

大一python編程題_請教python編程問題(作業就剩這幾道題了)

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓1. def cleanword(word):(用Python寫出程序&#xff0c;使程序可以通過下面的doctest)""">>> cleanword(what?)what>>> cleanword("now!")now>>> cleanword(?"word!,$…

Linux筆記1-5 --用戶

## 1 ## 用戶理解用戶就是系統使用者的身份在系統中用戶存儲為若干竄字符若干個系統配置文件用戶信息涉及到的系統配置文件&#xff1a;/etc/passwd ###用戶信息用戶&#xff1a;密碼&#xff1a;uid&#xff1a;gid&#xff1a;說明&#xff1a;家目錄&#xff1a;用戶使用…

python運維開發培訓_運維架構師-Python 自動化運維開發-014

運維架構師-Python 自動化運維開發-014九、標準數據類型1、為什么編程語言中要有類型類型有以下幾個重要角色&#xff1a;對機器而言&#xff0c;類型描述了內存中的電荷是怎么解釋的。對編譯器或者解釋器而言&#xff0c;類型可以協助確保上面那些電荷、字節在程序的運行中始終…

JavaScript | 演示函數中按值調用的示例

Here, we are designing a function named change() that has an argument and we are trying to change the value of the passed argument inside the function, but it will not effect to the main/actual argument that is passed as the argument while calling. 在這里&…

機器視覺支架制作(帶效果測試)

圖像處理系統中&#xff0c;鏡頭、光源的選配&#xff0c;對于最后能否產生穩定的識別效果至關重要。而搭載鏡頭、光源的是支架。機器視覺的支架一般都是根據項目的具體需要進行配置的&#xff0c;搜索淘寶能夠得到一些商品。 這些支架形狀不一&#xff0c;價格在數百元到千元之…

c語言中將整數轉換成字符串_在C語言中將ASCII字符串(char [])轉換為十六進制字符串(char [])...

c語言中將整數轉換成字符串Given an ASCII string (char[]) and we have to convert it into Hexadecimal string (char[]) in C. 給定一個ASCII字符串(char [])&#xff0c;我們必須在C中將其轉換為十六進制字符串(char [])。 Logic: 邏輯&#xff1a; To convert an ASCII …

redis rdb aof區別_理解Redis的持久化機制:RDB和AOF

什么是Redis持久化?Redis作為一個鍵值對內存數據庫(NoSQL)&#xff0c;數據都存儲在內存當中&#xff0c;在處理客戶端請求時&#xff0c;所有操作都在內存當中進行&#xff0c;如下所示&#xff1a;這樣做有什么問題呢&#xff1f;注 意文末有&#xff1a;3625頁互聯網大廠面…

python--批量下載豆瓣圖片

溜達豆瓣的時候&#xff0c;發現一些圖片&#xff0c;懶得一個一個扒&#xff0c;之前寫過c#和python版本的圖片下載&#xff0c;因此拿之前的Python代碼來改了改&#xff0c;折騰出一個豆瓣版本&#xff0c;方便各位使用 # -*- coding:utf8 -*- import urllib2, urllib, socke…

linux touch權限不夠,Linux下的Access、Modify、Change , touch的使用以及權限問題

每個文件在linux下面都會記錄許多的時間參數&#xff0c;其實是有三個主要的變動時間&#xff0c;那么&#xff0c;這三個時間的意義又是什么&#xff1f;下面我們來介紹&#xff1a;* Modify time(mtime)當該文件的“內容數據”更改時&#xff0c;就會更新這個時間。內容數據指…

scala 獲取數組中元素_從Scala中的元素列表中獲取隨機元素

scala 獲取數組中元素We can access a random element from a list in Scala using the random variable. To use the random variable, we need to import the Random class. 我們可以使用隨機變量從Scala中的列表訪問隨機元素。 要使用隨機變量&#xff0c;我們需要導入Rand…

ubuntu14.04下安裝cudnn5.1.3,opencv3.0,編譯caffe及配置matlab和python接口過程記錄

已有條件: ubuntu14.04cuda7.5anaconda2(即python2.7)matlabR2014a 上述已經裝好了,開始搭建caffe環境. 1. 裝cudnn5.1.3,參照:2015.08.17 Ubuntu 14.04cuda 7.5caffe安裝配置 詳情:先下載好cudnn-7.5-linux-x64-v5.1-rc.tgz安裝包(貌似需要官網申請) 解壓: tar -zxvf cudnn-7.…

python excel導入oracle數據庫_【Python代替Excel】12:Python操作oracle數據庫

日常工作中&#xff0c;如果有數據庫權限&#xff0c;那么在oracle中提取數據、在Python中處理是比較方便的。Python也提供了一個庫專門操縱數據庫。今天就專門來講講如何在Python中操作數據庫。準備工作需要工具&#xff1a;oracle、PL/SQL、Pythonimport cx_Oracle如果用anac…

Linux 金字塔 的shell命令,linux下保留文件系統下剩余指定數目文件的shell腳本

原文出處&#xff1a;http://www.jbxue.com/article/13808.html (原創文章&#xff0c;轉載請注明出處)本節內容&#xff1a;保留文件系統下剩余指定數目的文件例子&#xff1a;#!/bin/bash#-------------------------------#Description: Back up your files#site: www.jbxue.…

前端干貨之JS最佳實踐

持續更新地址 https://wdd.js.org/js-best-pr... 1. 風格 一千個讀者有一千個哈姆雷特&#xff0c;每個人都有自己的code style。我也曾為了要不要加分號給同事鬧個臉紅脖子粗&#xff0c;實際上有必要嗎&#xff1f; 其實JavaScript已經有了比較流行的幾個風格 JavaScript Sta…

python requests和urllib_Python——深入理解urllib、urllib2及requests(requests不建議使用?)...

深入理解urllib、urllib2及requestsPython 是一種面向對象、解釋型計算機程序設計語言&#xff0c;由Guido vanRossum于1989年底發明&#xff0c;第一個公開發行版發行于1991年&#xff0c;Python 源代碼同樣遵循 GPL(GNU General PublicLicense)協議[1] 。Python語法簡潔而清晰…