当前位置:网站首页>C # import details
C # import details
2022-04-23 02:09:00 【Guo Dong】
C# sentence
$.ajaxSettings.async = false;// Change to synchronous transmission , One by one
Paymode.payTime = DateTime.Now;// Get the current time
where tbRecord.returnNo == false// It can be filtered , Screening , Yes false, Before you can find
Recordsese.bookStateId = 4; To the database ,bookStateId add to 4 Choose the fourth
Modify
myModel.Entry(Recordsese).State = System.Data.Entity.EntityState.Modified;
Preservation
myModel.SaveChanges();
Inquire about S_book find allowVolume Subtract one
var book = myModel.S_book.Where(o => o.bookId == Recordsese.bookId).Single(); book.allowVolume = book.allowVolume - 1;
Razor C# Rule of grammar
Razor Is a markup syntax that adds server based code to web pages
The main Razor C# Rule of grammar
• Razor The code block is contained in @{ ... } in
• Inline expressions ( Variables and functions ) With @ start
• The code statement ends with a semicolon
• Variable usage var Keyword declaration
• The string is enclosed in quotation marks
• C# The code is case sensitive
• C# The file extension is .cshtml
such as :@{ string strUserName = "yers.usabkad.trim()"; } @strUserName
- @for (int i = 0; i < 10; i++) //for Follow the bad news {
- 123456
- }
Base number :
Decimal system | Binary system | octal | Hexadecimal |
---|---|---|---|
1 | 1 | 1 | 1 |
2 | 10 | 2 | 2 |
3 | 11 | 3 | 3 |
4 | 100 | 4 | 4 |
5 | 101 | 5 | 5 |
6 | 110 | 6 | 6 |
7 | 111 | 7 | 7 |
8 | 1000 | 10 | 8 |
9 | 1001 | 11 | 9 |
10 | 1010 | 12 | A |
11 | 1011 | 13 | B |
12 | 1100 | 14 | C |
13 | 1101 | 15 | D |
14 | 1110 | 16 | E |
15 | 1111 | 17 | F |
16 | 10000 | 20 | 10 |
17 | 10001 | 21 | 11 |
return File(index , @" image/jpeg"); return File Return the corresponding file ,index Returns a two-dimensional array file
$(this).prop("src",”/Main/ValiCOdexfhkde ?v=123“) ; Clear cache
$(this).prop("src",”/Main/ValiCOdexfhkde ?t=”+new Date().getTime());
new Date(); Create a time object ,getTime(); Time stamp To clear the cache
string strRandom=ValidCodeUtils.GetRandomCode(4)GetRandomCode(4), Represents random generation in a method 4 digit
type | example |
---|---|
Type of plastic surgery | byte( Byte type )、short( Short plastic surgery )、int( plastic )、long( Long integer ) |
floating-point | float and double |
Decimal type | decimal( Precision than float high ) |
Boolean type | bool |
Character type | string、char |
Empty type | null |
Type range :
float If you assign a value to a variable decimal , Without any suffix , The system will default to double type , If you use float Apply for variables to accept , May be an error !
num = num++; Post increment num = ++num; The first increment
Addition, subtraction, multiplication and division :
// Declare variables int x = 10, y = 8, z;
z = x + y; //int+string when ,int integer Auto convert to string String type , // No use z Back plus Tostring(); MessageBox.Show(" Add : " + z); z = x - y; MessageBox.Show(" Subtraction : " + z); z = x * y; MessageBox.Show(" Multiplication : " + z); // Divide two integer variables , There is no concept of decimals and rounding , The value is then equal to an integer . z = x / y; MessageBox.Show(" division : " + z); z = x % y; MessageBox.Show(" remainder : " + z);
// Addition of strings , It's stitching back and forth string s1 = "Hello", s2 = " world", res; res = s1 + s2; MessageBox.Show(res);
// Boolean value : really (true) false (false) bool boolmode; boolmode = 2 == 1; MessageBox.Show(boolmode.ToString()); boolmode = 2 != 1; MessageBox.Show(boolmode.ToString());
//&& And : You meet , I also want to meet , Otherwise false, You meet , I also meet , by true; // The whole is true
//|| or : You meet , by true, I'm in line with , by true, You and I are not qualified for false; // When it's true, it's true
bool b; bool b1 = true, b2 = false, b3 = true, b4 = false; b = b1 && b2;//false MessageBox.Show(b.ToString()); b = b1 || b2;//true MessageBox.Show(b.ToString()); b = b1 && b3;//true MessageBox.Show(b.ToString()); b = b1 || b4;//true MessageBox.Show(b.ToString());
When you come back from work , If you see a watermelon on the roadside, buy one , Buy two apples when you see them ; // x??y If s1 by null when , On the calculation s2, If not empty , On the calculation s1; string s1, s2, s3; s1 = null; s2 = "Hello"; s3 = s1 ?? s2; MessageBox.Show(s3);
Ternary expression :
If you see watermelon , Just buy an apple , If you don't see watermelon, buy a pomegranate ;
x?y:z If x If true, calculate y, If x If it is false, calculate z
string x="a",y="Hellp",z="world",m; m=x=="a"?y:z; MessageBox.Show(m); m=x=="b"?y:z; MessageBox.show(m);
int i = 1,j = 2; i = i + j; MessageBox.Show(i.ToString());
bool b = true; MessageBox.Show((!b).ToString()); // Non operation string L = " watermelon "; MessageBox.Show((!(L == " watermelon ")).ToString());
readonly( read-only )
static( static state )
const( Constant )
// Example formula : // The syntax form of the definition method is as follows : // Access modifier Modifier return type Method name ( parameter list ) //{ // Sentence block //}
Access modifier :
-
public( Any code access )
-
private( Members can only be accessed by code in the same class , If you don't use any access modifiers before class members operator , The default is private.)
-
internal( Members can only be accessed by code in the same project .)
-
protected( Members can only be accessed by code in a class or derived class . Derived classes are involved in inheritance , It will be described in detail later .)
Modifier :virtual( Virtual )、abstract( In the abstract )、override( Rewrite the )、static( Static )、sealed( Sealed )
版权声明
本文为[Guo Dong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220836454621.html
边栏推荐
- Shardingsphere sub database and sub table
- On LAN
- 89 logistic回歸用戶畫像用戶響應度預測
- What are the test steps of dynamic proxy IP?
- Tp6 Alibaba Cloud SMS Window message Curl Error 60: SSL Certificate Problem: Unable to get local issuer Certificate
- Realize linear regression with tensorflow (including problems and solutions in the process)
- Open3d point cloud processing
- Shardingsphere broadcast table and binding table
- 配置iptables实现本地端口转发的方法详解
- Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools
猜你喜欢
每日一题(2022-04-21)——山羊拉丁文
Nanny level tutorial on building personal home page (II)
How to choose a good dial-up server?
BGP服务器在什么业务场景会被用到?
006_redis_jedis快速入门
What is BGP server and what are its advantages?
Use Xdebug breakpoint debugging in postman
leetcode:27. Remove element [count remove]
Heap overflow of kernel PWN basic tutorial
009_Redis_RedisTemplate入门
随机推荐
Flink real-time data warehouse project - Design and implementation of DWS layer
011_RedisTemplate操作Hash
010_StringRedisTemplate
Applet canvas canvas half ring
[nk]牛客月赛48 D
Is the availability of proxy IP equal to the efficiency of proxy IP?
Chinese scientists reveal a new mechanism for breaking through the bottleneck of rice yield
从0开始开发一个chrome插件(2)
009_Redis_RedisTemplate入门
小程序 读取文件
Unicorn bio raised $3.2 million to turn prototype equipment used to grow meat into commercial products
[leetcode daily question] 396 Rotation function
If 404 page is like this | daily anecdotes
Leetcode40 - total number of combinations II
想体验HomeKit智能家居?不如来看看这款智能生态
How does Axure set the content of the text box to the current date when the page is loaded
【Chrome扩展程序】content_script的跨域问题
中金财富跟中金公司是一家公司吗,安全吗
Thinkphp内核开发盲盒商城源码v2.0 对接易支付/阿里云短信/七牛云存储
Use Xdebug breakpoint debugging in postman