/// <summary>
/// This function changes the file's extension name
/// which already has the extension name "xml","xsl","in" and "fpr"
/// </summary>
/// <param name="file">The file</param>
/// <returns>Return the changed file</returns>
private FileInfo SwitchExtension(ref FileInfo file)
{
//Get the file's extension and covert it to lower character
string extension = file.Extension.ToLower(); //Change the extension name of the file whose extension name is
//"xml","xsl","in" and "fpr".
//Just adds the "s" character to the head of the extension name
switch (extension)
{
case ".xml":
extension = ".SXML";
break;
case ".xsl":
extension = ".SXSL";
break;
case ".in":
extension = ".SIN";
break;
case ".fpr":
extension = ".SFPR";
break;
}
return file;
}这个原代码肯定有问题,我想用File.Extension = ".sxml",但是Extension是只读的,请教!谢谢。
/// This function changes the file's extension name
/// which already has the extension name "xml","xsl","in" and "fpr"
/// </summary>
/// <param name="file">The file</param>
/// <returns>Return the changed file</returns>
private FileInfo SwitchExtension(ref FileInfo file)
{
//Get the file's extension and covert it to lower character
string extension = file.Extension.ToLower(); //Change the extension name of the file whose extension name is
//"xml","xsl","in" and "fpr".
//Just adds the "s" character to the head of the extension name
switch (extension)
{
case ".xml":
extension = ".SXML";
break;
case ".xsl":
extension = ".SXSL";
break;
case ".in":
extension = ".SIN";
break;
case ".fpr":
extension = ".SFPR";
break;
}
return file;
}这个原代码肯定有问题,我想用File.Extension = ".sxml",但是Extension是只读的,请教!谢谢。
解决方案 »
- Form动态添加PictureBox,图片闪烁问题
- SQL查询语句问题,有点意思,快来看一下。
- 未处理IndexOutOfRangeException,索引超出数组界限
- 该事务管理器已经禁止了它对远程/网络事务的支持了
- 请教一下两个ado连接字符串的不同.
- 深夜发布操作Excel类库 功能excel文件创建修改单元格数据格式编辑图片图表插入控制外部数据的添加插入等
- 索引超出范围。DataGridTextBoxColumn dgtb = (DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[0];
- 如何在winform datagrid中只能编辑行,不能添加删除行!
- 广州C#爱好者聚会
- DATAGRID问题,各位大虾来帮帮忙~~~
- 为什么我自己写了一个用户控件,拖访到窗体里边,报错说“未将对象引用设置到对象的实例”
- 关于session和cookie的问题?高手请进。
File.Move(旧文件路径,新文件路径)eg:
File.Move("C:\1.in","C:\1.sin")
反正格式是用-SwitchExtension(FileInfo) : FileInfo
fileinfo.name就是文件名啊?
你可以得到文件名,然后解析,替换后缀
在move