当前位置:网站首页>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
边栏推荐
- Latin goat (20204-2022) - daily question 1
- R language advanced | generalized vector and attribute analysis
- 浅析静态代理ip的三大作用。
- Redis memory recycling strategy
- PHP & laravel & master several ways of generating token by API and some precautions (PIT)
- They are all intelligent in the whole house. What's the difference between aqara and homekit?
- What is an API interface?
- Want to experience homekit smart home? Why don't you take a look at this smart ecosystem
- World Book Day 𞓜 a good book that technicians should not miss (it cutting-edge technology)
- Easyswool environment configuration
猜你喜欢

Find the largest number of two-dimensional arrays

小程序 canvas 画布半圆环
Unicorn bio raised $3.2 million to turn prototype equipment used to grow meat into commercial products

89 logistic回归用户画像用户响应度预测

世界读书日 | 技术人不要错过的好书(IT前沿技术)

在使用代理IP前需要了解哪些分类?

What is a dial-up server and what is its use?

每日一题(2022-04-22)——旋转函数

Common formatting problems after word writing

89 régression logistique prédiction de la réponse de l'utilisateur à l'image de l'utilisateur
随机推荐
What are the test steps of dynamic proxy IP?
Log4j2 configuration
Halo open source project learning (I): project launch
Startup of openstack service
Tp6 Alibaba Cloud SMS Window message Curl Error 60: SSL Certificate Problem: Unable to get local issuer Certificate
如何选择一台好的拨号服务器?
Analyze the advantages and disadvantages of tunnel proxy IP.
89 logistic回归用户画像用户响应度预测
tp6阿里云短信 window 报 cURL error 60: SSL certificate problem: unable to get local issuer certificate
ThinkPHP kernel development blind box mall source code v2 0 docking easy payment / Alibaba cloud SMS / qiniu cloud storage
Arduino esp8266 network upgrade OTA
Shardingsphere introduction and sub table usage
从0开始开发一个chrome插件(2)
小程序 canvas 画布半圆环
Micro build low code zero foundation introductory course
什么是bgp服务器,有哪些优势?
Dynamic batch processing and static batch processing of unity
What is a dial-up server and what is its use?
简洁开源的一款导航网站源码
011_RedisTemplate操作Hash