如何在c#windows form app中分隔单词的字符? [英] How to separate characters of a word in c# windows form app?

查看:73
本文介绍了如何在c#windows form app中分隔单词的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题:



1我想在文件夹中获取所有文件的名称。我该怎么做?

2如何分隔一个单词的前8个字符?



我想制作一个能够获取文件夹地址并将其分开的ac#windows表单应用程序他们名字相同的图片(前8个字符显示他们拍摄的日期)

我在网上搜索我发现了一个解决方案,但是使用system.linq并不起作用class.visual studio不认识这个班级!

谢谢

I have 2 questions:

1 I want to get all file''s name in a folder.How can I do this?
2 How can I separate first 8 characters of a word?

I wanna make a c# windows form app that is able to get a folder address and separate the pictures that their name is equal(first 8 characters show the date they had taken)
I search the web and I found a solution but it doesn''t work that is using the "system.linq" class.visual studio doesn''t recognize this class!
Thanks

推荐答案

1)使用Directory.GetFiles [ ^ ]。请参阅: http://www.csharp-examples.net/get-files-from-directory/ [ ^ ]

2)使用 Substring [ ^ ]方法。请参阅: http://www.dotnetperls.com/substring [ ^ ]
1) Use Directory.GetFiles[^]. See: http://www.csharp-examples.net/get-files-from-directory/[^]
2) Use Substring[^] method. See: http://www.dotnetperls.com/substring[^]


应该识别Linq,同时更新你的VS'

确保你已经使用System.Linq写了特定的类;
Linq should be recognized, update your VS'' also:
make sure you have written in that specific class "using System.Linq;"


是substring是获取文件名的最佳方法
yes substring is the best way to get the name of file


这篇关于如何在c#windows form app中分隔单词的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆