公共actionresult细节(int?Id)写int的目的是什么? ID ......? [英] Public actionresult details(int? Id) what is purpose of writing int ? id ......?

查看:99
本文介绍了公共actionresult细节(int?Id)写int的目的是什么? ID ......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

plz告诉我......如果写int是什么目的? id in detail()action meathod



我尝试过:



i试过......它是一个外卡字符,如*?

plz Tell me..what is purpose if writing int ? id in detail() action meathod

What I have tried:

i have tried ... is it a wild card character like * ?

推荐答案

它不是一个通配符说明符,它是一个语言元素。

It's not a "wildcard" specifier, it's a language element.
int x;

创建一个值类型整数,这意味着它不能包含除通常的整数值范围:2147483647到-2147483648(含)。具体来说,因为它是一个值类型,当你添加问号时它不能包含 null



creates a value type integer which means that it cannot contain anything other than the usual range of integer values: 2147483647 to -2147483648 inclusive. Specifically, because it is a value type, it can't contain null.
when you add the question mark:

int? x;

您正在创建一个可以为空的整数 - 一个可以包含相同范围的值,但也可以包含 null

可空类型(C#编程指南) [ ^ ]

这些可以是PITA,所以除非你需要,否则不要使用它们。

You are creating a nullable integer - one which can contain the same range of values, but can also contain null
Nullable Types (C# Programming Guide)[^]
These can be a PITA to work with, so don't use them unless you need them.


这篇关于公共actionresult细节(int?Id)写int的目的是什么? ID ......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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