list 交换位置扩展
2024-08-24 16:17:40
public static List<T> Swap<T>(this List<T> list, int index1,int index2)
{
if(index1<0||index1>=list.Count)
{
throw new Exception("index1");
}
if (index2 < 0 || index2 >= list.Count)
{
throw new Exception("index2");
}
var temp = list[index1];
list[index1] = list[index2];
list[index2] = temp;
return list;
}
最新文章
- CSS3 3D立方体效果-transform也不过如此
- yii2 RESTful api的详细使用
- Loadrunner ---集合点设置
- Web框架们
- ios资源
- 独立博客开张!有关读书、GTD和IT方面的内容将发布在新网站上
- html中怎么去掉input获取焦点时候的边框
- python study - 正则表达式
- 自定义 SharePoint 2010 快速启动栏和顶部链接栏
- 底部菜单栏(三)Fragment+FragmentTabHost实现仿新浪微博底部菜单栏
- Cocos2d-x 3.1.1 学习日志9--一“上一下其乐无穷”游戏开发系列一
- 用JS添加和删除class类名
- JVM GC算法
- 写的还不错的专题,android性能优化
- Java 保留两位小数填坑
- 【CSS学习】--- float浮动属性
- Oracle函数——日期函数
- PHP-1安装配置
- 基于python+appium+yaml安卓UI自动化测试分享
- Kibana加载样本数据