难道就没人知道这个问题吗?

antinet 2009-11-17 04:41:15
在C++中常用的头文件,在C#中用什么方法实现?比如定义宏,声明函数的原型,以及自定义数据类型等。C#好像没有头文件了
...全文
86 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chaohun 2009-11-17
  • 打赏
  • 举报
回复
C#没了这玩意了,C#理念是完全的面向对象,其实像这样的东西如果需要的话,完全可以用枚举来代替啊,
例如
public enum Define
{
ACK = 0x06
}
Error_Code 2009-11-17
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 antinet 的回复:]
假如某个C程序的头文件定义了一个宏#define ACK 0x06
[/Quote]
public class helloworld
{
public const int ACK = 0x06;
}

public class mainCls
{
static void Main(string[] args)
{
console.writeline(helloworld.ACK);
}
}
antinet 2009-11-17
  • 打赏
  • 举报
回复
假如某个C程序的头文件定义了一个宏#define ACK 0x06
在C#中,如何实现?
PandaIT 2009-11-17
  • 打赏
  • 举报
回复
根本就不是一类东西!

命名空间using System;

public String hello()
{
return "hello world!";
}

int i=10;
String xx="我叫String";

你还是从头看起吧!

从第一个hello world来!BS你这个标题!!
lee_b 2009-11-17
  • 打赏
  • 举报
回复

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using System.IO;
using System.Collections;
using WorldWind;
using System.Xml;

这写东西
沉默味道ron 2009-11-17
  • 打赏
  • 举报
回复
using.没怎么明白lz的意思。
lee_b 2009-11-17
  • 打赏
  • 举报
回复

using ....引用你要的东西

111,115

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧