天天看点

Java和C#基本类库的区别

java.lang

java .net
Boolean System.Boolean
Byte System. Byte
Character System.Char
Class System.Type
Double System.Double
Float System.Single
Integer System.Int32
Long System.Int64
Math System.Math
Object System.Object
Process System. Diagnostics .Process
Runtime
Short System.Int16
StrictMath
Strng System.Strng
StringBuffer System. Text .StringBuffer
Thread System. Threading .Thread
ThreadLocal System.LocalDataStoreSlot

java.lang.reflect

AccessibleObject System.reflection.MemberInfo
Array System. Array
Constructor System.reflection.ConstructorInfo
Field System.reflection.FieldInfo
Method System.reflection.MethodInfo
Modifier System.reflection.MethodAttributes
ReflectdPermission System. Security . Permissions.ReflectdPermission

java.lang.ref

WeakReference System.WeakReference

java.util包

java.util

AbstractColletion System.Collections.CollectionsBase
ArrayList System.Collections.ArrayList
Arrays System.Arrays
BitSet System.Collections.BitArray
Calendar System.Globalization.Calendar
Currency System.Globalization.RegionInfo
Date System.Datetime
Dictionary System.Collections.DictionaryBase
EventObject System.EventArgs
GregorianCalendar System.Globalization.GregorianCalendar
HashMap System.Collections.HashMap
Hashtable
ListResourseBundle System.Resources.ResourceManger
Locale System.Globalization.CultureInfo
Random System.Random
ResourseBundle System.Resources.ResourceSet
SimpleTimeZone
Stack System.Collections.Stack
Timer System.Threading.Timer
TimerTask System.Threading.TimerCallback
TimeZone System.DataTime
TreeSet System.Collections.SortedList
Vector

java.util.regex

Matcher

System.Text.RegularExpressions.Match

System.Text.RegularExpressions.MatchCollection

System.Text.RegularExpressions.Group

System.Text.RegularExpressions.GroupCollection

Pattern

System.Text.RegularExpressions.Regex

System.Text.RegularExpressions.RegexCompilationInfo

System.Text.RegularExpressions.RegexOption

PatternSyntaxExcetpion System. ArgumentExcetion

java.util.logging/java.util.jar/java.util.zip/java.util.pref 包中的类在.NET中没有与之对应的部分

java.io包

BufferedInputStream System.IO.BufferedStream
BufferedOutputStream
BufferedReader System.IO.StreamReader
BufferedWriter System.IO.StreamWriter
ByteArrayInputStream System.IO.MemoryStream
ByteArrayOutputStream
CharArrayReader
CharArrayWriter
DataInputStream System.IO.BinaryReader
DataOutputStream System.IO.BinaryWriter
File System.IO.File
FileInputStream System.IO.FileStream
FileOutputStream
FileReader
FileWriter
InputStream System.IO.Stream
OutputStream
PrintStream
PrintWriter
PushbackInputStream
PushbackOutputStream
RamdomAccessFile
StringBufferInputstream System.IO.StringReader
StringReader
StringWriter System.IO.StringWriter

java.sql包

.net 中没有与javax.sql包直接对应的部分,System.Data命名空间提供了连接池和事务处理类。

java的Rowset类在某些方面与.net的DataDet类相似

Blob

System.Data.Sqlclient.SqlDataReader

System.Data.OleDb.OleDbDataReader

CallableStatement

System.Data.Sqlclient.Sqlcommand

System.Data.OleDb.OleDbcommand

Clob
Connection

System.Data.Sqlclient.Sql

System.Data.OleDb.OleDb

System.Data. SqlTypes . SqlDateTime
ParameterMetaData

System.Data.Sqlclient.SqlParameter

System.Data.OleDb.OleDbParameter

PreparedStatement

System.Data.Sqlclient.SqlCommand

System.Data.OleDb.OleDbCommand

ResultSet
ResultSetMetaData
Savepoint System.Data.Sqlclient. SqlTransaction
SQLPermission

System.Data.Sqlclient.SqlclientPermission

System.Data.OleDb.OleDbPermission

Statement
Time
Types System.Data.DbTypes

java.text包

DataFormat System.DateTime
DateFomatSymbols System.Globalization.DateaTimeFormatInfo
NumberFormat System.Globalization.NumberFormatInfo
SimpleDateFormat System.Globalization.DateTimeFormatInfo
StringCharacterIterator System.IEnumerator (System,String)

org.w3c.dom包

Attr System.Xml.XmlAttribute
CdatSection System.Xml.XmlCDataSetion
CharacterData System.Xml.XmlCharacterData
Comment System.Xml.XmlComment
Document System.Xml.XmlDocument
DocumentFragment System.Xml.XmlDocumentFragment
DocumentType System.Xml.XmlDocumentType
DOMImplementation System.Xml.XmlDOMImplementation
Element System.Xml.XmlElement
Entity System.Xml.XmlEntity
EntityReference System.Xml.XmlEntityReference
NameNodeMap System.Xml.XmlNameNodeMap
Node System.Xml.XmlNode
NodeList System.Xml.XmlNodeList
Notation System.Xml.XmlNotation
ProcessingInstruction System.Xml.XmlProcessingInstruction
DOMException System.ArgumentException

javax.swing包

.net没有提供与下列包直接等价的类:

javax.swing.plaf/javax.swing.border/javax.swing.table/javax.swing.text( 可用System.Windows.Form.RichTextBox 代替 ) 和 javax.swing.filechooser ( 可用System.Windows.Form.OpenFileDialog 和 System.Windows.Form.SaveFileDialog 代替 )

javax.swing

AbstractButton System.Windows.Forms. ButtonBase
AbstractListModel System.Windows.Forms.ListControl
AbstractSpinnerModel System.Windows.Forms.UpDownBase
ImageIcon System.Windows.Forms.Image
Jbutton System.Windows.Forms.Button
JCheckBox System.Windows.Forms.CheckBox
JColorChooser System.Windows.Forms.ColorDialog
JComboBox System.Windows.Forms.ComboBox
JComponent System.Windows.Forms.UserControl
JDialog System.Windows.Forms.CommonDialog
JEditorpane System.Windows.Forms.TextBoxBase
JFileChooser System.Windows.Forms.OpenFileDialog
JFormattedTextField System.Windows.Forms.RichTextBox
JFrame System.Windows.Forms.Form
JLabel System.Windows.Forms.Label
JList System.Windows.Forms.ListBox
JMenuBar System.Windows.Forms.MainMenu
JMenuItem System.Windows.Forms.MenuItem
JPanel System.Windows.Forms.Panel
JPasswordField System.Windows.Forms.TextBox
JPopupMenu System.Windows.Forms.ContextMenu
JProgressBar System.Windows.Forms.ProgressBar  StatusBar
JRadioButton System.Windows.Forms.RadioButton
JScrollBar

System.Windows.Forms.HScrollBar

System.Windows.Forms.VScrollBar

JScrollPane
JSlider System.Windows.Forms.TrackBar
JSpinner System.Windows.Forms.DomainUpDown
JSpitPane System.Windows.Forms.Splitter
JTable System.Windows.Forms.ListView
JTextArea
JTextField
JTextPane
JTogleButton
JToolBar System.Windows.Forms.ToolBar
JToolTip System.Windows.Forms.ToolTip
JTree
Popup
System.Windows.Forms.Timer

javax.swing.event

CaratEvent
ListDataEvent
ListSelectionEvent
MenuEvent
PopupMenuEvent

java.awt包

java.awt

AWTEvernt
AWTKeyStroke System.Windows.Forms.KeyPressEventArgs
AWTPermission System.Security.Permissions.UIPermission
BasicStroke System.Drawing.Pen
Button
Canvas System.Windows.Forms. Control
CheckBox
Choice
Color System.Drawing.Color
Component
Container
Cursor System.Windows.Forms.Cursor
Dialog
Dimension System.Drawing.Size
Event
FileDialog System.Windows.Forms.FileDialog
Font System.Drawing.Font
Frame
GradientPaint System.Drawing.Drawing2D.LinearGradientBrush
Graphics System.Drawing.Graphics
Graphics2D
Image System.Drawing.Image
JobAttribute System.Drawing.Printing. PageSettings
Label
List
Menu
MenuItem
PageAttributes
Panel System.Windows.Forms. Panel
Point System.Drawing.Point
PopupMenu
PrintJob System.Drawing.Printing.PrintDocument
Rectangle System.Drawing.Rectangle
Scrollbar

System.Windows.Forms.HScrollbar

System.Windows.Forms.VScrollbar

ScrollPane
TextArea System.Windows.Forms. TextBox
TextField
TexturePaint System.Drawing.TextreBrush

java.awt.event

ActionEvent
AdjustmentEvent System.Windows.Forms.ScrollEventArgs
ComponentEvent
ContainerEvent System.Windows.Forms.ControlEventArgs
FocusEvent
ItemEvent
KeyEvent
MouseEvent System.Windows.Forms.MouseEventArgs
PaintEvent System.Windows.Forms.PaintEventArgs
TextEvent
WindowEvent

java.awt.print

PageFormat System.Drawing.Printing.PageSettings
Paper System.Drawing.Printing.PageSize
PrinterJob
1