惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - 柠檬隐士

Win8下使用Ctrl加空格来切换输入法 3L软件网站 - 音速启动 (C#)Windows Shell 外壳编程系列9 - QueryInfo 扩展提示 (C#)Windows Shell 外壳编程系列8 - 同后缀名不同图标? (C#)Windows Shell 外壳编程系列7 - ContextMenu 注册文件右键菜单 .NET 异常处理 WebBrowser控件使用详解 SQL连接查询深度探险 悲壮的一天,记华为核心网面试经历 光驱发展史 50年变大了八万倍!超经典硬盘发展史 回首风雨路 笔记本二十年发展史 技术革命 十年芯片组发展回顾 鼠标37年发展史 浅谈键盘的发展史 - 柠檬隐士 声卡发展史 见证PC发展历史:细数内存的发展历程 - 柠檬隐士 从胡萝卜到4毫秒:液晶显示器发展的120年 - 柠檬隐士 从8Mhz到4Ghz+ CPU发展历程也精彩 - 柠檬隐士
C#一行代码实现整数取反函数
柠檬隐士 · 2013-06-09 · via 博客园 - 柠檬隐士

题目很简单,完成函数reverse,要求实现把给定的一个整数取其相反数的功能,举两个例子如下: x = 123, return 321 x = -123, return -321

请注意,下面真是一行代码,只有一个分号的。不知道大家能否看懂:

private int reverse(int i)
{
    return int.Parse((i > 0 ? "" : "-") + new string((new Stack<char>((IEnumerable<char>)Math.Abs(i).ToString())).ToArray()));
}