C#,GenerateCharacterCount .....问题! [英] C#, GenerateCharacterCount.....problem !

查看:63
本文介绍了C#,GenerateCharacterCount .....问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Windows窗体中而不是在控制台中遇到"GenerateCharacterCount"问题.
E.x我有一条短信

Hi,
I have a problem with "GenerateCharacterCount"...in windows form, not in console.
E.x I have a text

string ="Hello World";

label1.text="character count: " + GenerateCharacterCoun(data).Tostring();



但是在Windows中,"GenerateCharacterCount"是未知的,没有人能告诉我们问题出在哪里……我应该添加任何引用或其他内容. !


Thnx!



but in windows for "GenerateCharacterCount" is unknown, does anyone can tell we where is a problem.... shuld I add any reference or what. !


Thnx !

推荐答案

可能会有所帮助,
It might help,
using System;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string dataToTest="Hello World<>@@@


## 555 !!!"; Console.WriteLine(" ,dataToTest.Where(ch = > Char.IsLetter(ch)).Count()); Console.WriteLine(" ,dataToTest.Length); } } }
##555!!!"; Console.WriteLine("Total Characters: {0}",dataToTest.Where(ch => Char.IsLetter(ch)).Count()); Console.WriteLine("Total Length: {0}", dataToTest.Length); } } }



:)



:)


在Windows窗体中尝试下面的一个


try the below one in windows forms


string strsample = "Hello World";
label1.Text = "character count: " + strsample.Length.ToString();


这篇关于C#,GenerateCharacterCount .....问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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